Skip to content
Advertisement

SimpleXML looping through

I get product data via xml like that

JavaScript

and in my php (shortened to the relevant parts)

JavaScript

If I try to loop through the brand the following happens

JavaScript

edited because I figured I was way to verbose.

Advertisement

Answer

The reason this is happening is because of how SimpleXMLElement handles it’s iterator. You can iterate through the element using the get_object_vars function.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement