Skip to content

Instantly share code, notes, and snippets.

Created Jun 17, 2016
What would you like to do?
php. get max or min in array except zero(or something)
$myArray = array(1,0,2,3,0,4,5,99,6,7,8,9,0);
$except = array(0);
$value = min(array_values(array_diff($myArray, $except)));
// $value == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment