Created
June 17, 2016 08:14
-
-
Save devflow/5b29c91af36951dc9d9d463482fb4e3c to your computer and use it in GitHub Desktop.
php. get max or min in array except zero(or something)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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