$array = [0,1,2,3,4,5,6];
$min = min($array);
$max= max($array);
- I want min as 1 and max as 6 i don't want to consider 0 as min with php array.
Use array_filter to filter the zero out of the array
$a = array(0,1,2,3,4,5,6);
$a = array_filter($a);
$min = min($a);
$max = max($a);
array_filter is still the correct answer
0from the array. I don't think there is any other way.min. Other solutions would involve writing your own custom version ofmin.