php - Find Array value ranges max and min value -
here array how can find minimum , maximum value. i.e,
output must min=0;max=15 array ( [0] => 5-10 [1] => 10-15 [2] => 0-2 [3] => 15 )
<?php $price_range=array("0-2","2-5","5-10","10-15","15"); foreach($price_range $key=>$value){ $a=explode('-',$value); if($a[0] != ''){$b[]= $a[0];} if($a[1] != ''){$b[]= $a[1];} } echo 'min: '.$min=min($b); echo 'max: '.$max=max($b); ?>
Comments
Post a Comment