Jump to content

Does PHP have anything like e4x?


tibberous

Recommended Posts

Lets say this is my xml:

 

$xml = "<root><people><person><name>bob</name></person><person><name>trent</name></person></people></root>";

 

I want to be able to get $root->people as an array, then loop through $root->people[$i] and print out their names. Actionscript makes this remarkably easy with E4X, does PHP have something similar?

 

I hate the xml_parser_create way of doing things - but using preg_match_all just feels like a hack.

Link to comment
Share on other sites

Yeah - that's what I'm looking for, even though it either doesn't support full XML or is buggy. It won't read my XML if I leave the SOAP namespaced elements around it, even though FF and IE read the xml file as valid. I was able to get it to work by preg_matching one of the more-inner tags =/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.