I am trying to import each story into an object. Each object will have multiple strings (start and end) along with arrays generated from content in the additional-content. An small example would be:
<feed>
<story>
<run>
<start>1/1/2012</start>
<end>3/1/2012</end>
</run>
<additional-content>
<content>
<sample>Sample story example</sample>
</content>
<content>
<sample>Sample story example</sample>
</content>
</additional-content>
</story>
...
</feed>
I all the xml being imported to a string. Also, I am trying to do this without libraries. I understand looping through each story but am unsure how to load the content into the object while also generating the array correctly. Any help would be appreciated.
simplexml loads xml into an object and you'll be able to work with it exactly as you're asking.
$xml = simplexml_load_string($stories);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With