I was in need of checking if the given array is all numeric or not. A colleague suggested with snippet the use of array_reduce – here the implementation
$numbers = array(1,22, 7, 34, 20); $all_numbers = array_reduce($numbers, function($val1, $val2){ return $val1 && is_numeric($val2); }, TRUE);
Should do the trick.
zaTisIT!!