MAX & MIN values on array using PHP -


does knows how can max , min value of 2nd , 3rd columns in php?

$ar = array(array(1,  10,   9.0,   'hello'),             array(1,  11,  12.9,   'hello'),             array(3,  12,  10.9,   'hello')); 

output should like:

max(12.9) min(10)

<?php $ar = array(array(1,  10,   9.0,   'hello'),             array(1,  11,  12.9,   'hello'),             array(3,  12,  10.9,   'hello')); function col($tbl,$col){     $ret = array();     foreach ($tbl $row){         $ret[count($ret)+1] = $row[$col];     }     return $ret; } print (max(col($ar,2))."\n"); print (min(col($ar,1))."\n"); ?> 

is for? guess not efficient way.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -