jkkenzie Posted May 10, 2008 Share Posted May 10, 2008 I have three variable $val1, $val2 and $val3. $val1="1",$val1="2" and $val1="3". how do i figure out which is the variable with highest value using php code? Thanks in advance. Joe Link to comment https://forums.phpfreaks.com/topic/104999-get-the-hishest-value-from-different-variables/ Share on other sites More sharing options...
cheechm Posted May 10, 2008 Share Posted May 10, 2008 max($val1, $val2, $val3); Link to comment https://forums.phpfreaks.com/topic/104999-get-the-hishest-value-from-different-variables/#findComment-537443 Share on other sites More sharing options...
phorcon3 Posted May 10, 2008 Share Posted May 10, 2008 <?php $values=array(1,2,10,3); sort($values); foreach($values as $key=>$val){$highest=$val;} echo $highest; ?> dumbest way i could possibly think of ^^.. but it does the trick;)... Link to comment https://forums.phpfreaks.com/topic/104999-get-the-hishest-value-from-different-variables/#findComment-537445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.