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
https://forums.phpfreaks.com/topic/202897-does-php-have-anything-like-e4x/
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 =/

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.