I have some JSON that looks like this:
$str = '{"movies":[{"id":"11007","title":"The Pink Panther"},{"id":"11118","Breathless"]}';
This would appear to be a dictionary {} with key "movies" and value an array [] of items that are movies.
After decoding it into an associative array with:
$array = json_decode($str, true);
It looks like:
Array ( [movies] => Array ( [0] => Array ( [id] => 11007 [title] => The Pink Panther) [1] => Array ( [id] => 11118 [title] => Breathless) ) )
How can I get a random movie eg The Pink Panther and access its title and id?
array['movies'] just seems to give me the array itself and array_rand($array) also just gives me back the index of the same array since there is only one.
How do I get into the array of movies so that I can grab a random one?
Thanks for any suggestions.