homepage Welcome to WebmasterWorld Guest from
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 / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

PHP: How to Sort an Array Through Loop
PHP: How to Sort an Array

 11:34 am on Aug 18, 2008 (gmt 0)

I am working on a web page that lists some property stored in an XML
file and I'm having trouble with figuring out how to sort the listings by their "price" element. Currently I pull the "property" elements from the XML into an array and print out the HTML list of property in a non-sorted manner.
I'd like it to print out with a acceding oder for the price followed by a list of property in that price. I'm not sure how to code it though. Any help would be
appreciated. Below is a snippet from the XML file:

<?xml version="1.0" encoding="iso-8859-1" ?>
<Street>Clifton Road</Street>
<Address3>Newbury Park</Address3>

<Street>Clifton Road</Street>
<Address3>Newbury Park</Address3>



 12:06 pm on Aug 18, 2008 (gmt 0)

Hi chamara, and welcome to WebmasterWorld!

I suspect that you would be helped by asking this in the PHP Forum [webmasterworld.com], as well as this one.

You can use the PHP SimpleXML [us2.php.net] or the PHP DOMXML [us2.php.net] support to parse and sort the XML, but the printing will probably done through good old-fashioned PHP routines.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
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