programming-examples/php/Arrays/PHP function that returns the lowest integer that is not 0..php

7 lines
187 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?php
function min_values_not_zero(Array $values)
{
return min(array_diff(array_map('intval', $values), array(0)));
}
print_r(min_values_not_zero(array(-1,0,1,12,-100,1))."\n");
?>