$response is a SimpleXML element and an initial var_dump shows it as an array but I can’t loop through it. It turns into an object when I access it specifically.
Any suggestions?
var_dump($response); //shows KeyResult as array
if (is_array($response->KeyResult)) { //returns false
$addressRankings = array();
foreach ($response->KeyResult as $rating) {
print_r($rating);
Here’s the var_dump
object(SimpleXMLElement)#8 (1) {
["KeyResult"]=>
array(10) {
[0]=>
object(SimpleXMLElement)#7 (5) {
var_dumpdumps the SimpleXML object content, but when you call->KeyResultit has more magic (like __get method), which returns not an array: