pouncer Posted April 7, 2007 Share Posted April 7, 2007 foreach($itemNodes as $item) { $price = $item->getElementsByTagName('CurrentPrice'); echo $price->item(0)->nodeValue . "<br>"; } It echos a list of prices.. fine. But how can i somehow grab the highest/lowest price from it! Quote Link to comment https://forums.phpfreaks.com/topic/45997-getting-the-most-expensive-and-cheapest-price/ Share on other sites More sharing options...
pouncer Posted April 7, 2007 Author Share Posted April 7, 2007 any experts around who can help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/45997-getting-the-most-expensive-and-cheapest-price/#findComment-223519 Share on other sites More sharing options...
wildteen88 Posted April 7, 2007 Share Posted April 7, 2007 You might need to show more code of your class. Or if I'm misunderstanding you then look into the min and max functions over at php.net Quote Link to comment https://forums.phpfreaks.com/topic/45997-getting-the-most-expensive-and-cheapest-price/#findComment-223542 Share on other sites More sharing options...
cmgmyr Posted April 7, 2007 Share Posted April 7, 2007 if you are using a database you can do something like: SELECT max(price) as highest, min(price) as lowest FROM table Quote Link to comment https://forums.phpfreaks.com/topic/45997-getting-the-most-expensive-and-cheapest-price/#findComment-223577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.