3

$string从 cURL 中检索到这样一个:

{"time":0.01,"total_rows":7,"rows":[{"id":968},{"id":969},{"id":970},{"id":971},{"id":972},{"id":973},{"id":974}]}

我想知道如何获得id最大的值(即 974),我该如何在 PHP 中做到这一点?

4

1 回答 1

5
$result = '{"time":0.01,"total_rows":7,"rows":[{"id":968},{"id":969},{"id":970},{"id":971},{"id":972},{"id":973},{"id":974}]}';
$json = json_decode($result,true);
$max = max($json["rows"]);
echo $max["id"]; // "974"
于 2013-04-27T04:03:01.220 回答