Skip to content

Instantly share code, notes, and snippets.

@devflow
Created Jun 17, 2016
Embed
What would you like to do?
php. get max or min in array except zero(or something)
<?php
$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