I’m building a JSON array as follows:
$footerSEOArray[$data['domainname']] = $data[$language];
echo json_encode($footerSEOArray);
Once passed back I decode it like this:
$footerLinks = json_decode($result);
I can print the array as follows:
print_r($footerLinks);
And when printed it looks like this:
stdClass Object
(
[www.data1.com] => Australia
[www.data2.com] => Hindu
[www.data3.com] => Laos
[www.data4.com] => Iranian
[www.data5.com] => America
)
Now I need to be able to print the first and second parts of the array but I can’t seem to get it to print outside of the print_r();
thx
You have to pass to json_decode an additional parameter to obtain an array instead that a generic array.
Reference: The php manual json_decode page