Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我$string从 cURL 中检索到这样一个:
$string
{"time":0.01,"total_rows":7,"rows":[{"id":968},{"id":969},{"id":970},{"id":971},{"id":972},{"id":973},{"id":974}]}
我想知道如何获得id最大的值(即 974),我该如何在 PHP 中做到这一点?
id
$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"