homepage Welcome to WebmasterWorld Guest from 54.167.138.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
simplexml load string question
order by
gosman




msg:4258854
 11:55 am on Jan 27, 2011 (gmt 0)

I'm using simplexml_load_string to load an xml file. Is it possible to order the xml returned by node name.

Example the xml is always returned ordered by <item> but I want to output by <distance>

<item>1</item>
<distance>3</distance>

<item>2</item>
<distance>2</distance>

<item>3</item>
<distance>1</distance>

Any help really appreciated.

 

coopster




msg:4262277
 3:32 pm on Feb 3, 2011 (gmt 0)

You will likely need to assign the nodes to an array (but if memory serves me correctly, they are already in an array) and then use a custom call back function to sort the array.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved