Created
May 26, 2012 06:38
-
-
Save zyphlar/2792596 to your computer and use it in GitHub Desktop.
finding minimal value of a simplexml object in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_min_rent($xml, $floorplanid) { | |
$min_rent = 999999; // a ridiculously high number | |
foreach($xml->xpath("/PhysicalProperty/Property/Unit[@FloorplanID='$floorplanid']") as $unit) { | |
if($unit->EffectiveRent['min'] < $min_rent) { // save this rent amount if it's the lowest so far | |
$min_rent = $unit->EffectiveRent['min']; | |
} | |
} | |
return $min_rent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment