Hey guys, I want to parse some xml but I don’t know how I can get the same tags out of 1 element.
I want to parse this:
<profile>
<name>john</name>
<lang>english</lang>
<lang>dutch</lang>
</profile>
So I want to parse the languages that john speaks. how can I do that ?
You can run a
foreachloop over the element node after you’ve pulled it in with SimpleXML like so:This has the benefit of being able to handle any number of
langelements you may have or not have for each profile element.