Skip to content

Instantly share code, notes, and snippets.

@devflow
Created June 17, 2016 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devflow/5b29c91af36951dc9d9d463482fb4e3c to your computer and use it in GitHub Desktop.
Save devflow/5b29c91af36951dc9d9d463482fb4e3c to your computer and use it in GitHub Desktop.
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