JSON_DECODE - get values from multidimensional array stdClass

How can I get the specific value from multidimensional array with stdClass object using json_decode ? For example, when I use $array['users'][16] in regular array, I will get the value for user with ID 16. How can I do this in case of JSON ?
give a positive ratinggive a negative rating
20 Jun 2021 at 12:10 PM

You can get the values from stdClass Object multidimensional array in a similar way, than in case of standard array. What you need to do, is include true parameter into json_decode function.

For example:

$json_array = '{"users":{"10":"Abc", "16":"Abcde"}}';

$array = json_decode($json_array, true);

echo $array['users'][16];

give a positive ratinggive a negative rating
23 Jun 2021 at 10:25 AM
Share on FacebookShare on TwitterShare on LinkedInSend email
Follow us on Facebook
2022 AnswerTabsTermsContact us