I have a PHP key/value array and I want to grab a value from there and display it in a div.
So far I have:
$homepage = file_get_contents('http://graph.facebook.com/1389887261/reviews');
$parsed = json_decode($homepage);
I want to get the values out of the key/value pair array like this:
foreach ($parsed as $key => $values){
echo $values['rating'];
}
But this does not retrieve the value. What am I doing wrong?
Use the PHP foreach index reference, this gives you the ability to grab the key or the value.
http://www.php.net/manual/en/control-structures.foreach.php