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! 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? 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 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 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
Archived
This topic is now archived and is closed to further replies.