Checks to see if all the values in the array are numeric.
Parameters
- array $array The array to check. If null, the value of the current Set object.
Returns
mixed `true` if values are numeric, `false` if not and `null` if the array to check is empty.Source
public static function isNumeric($array = null) {
if (empty($array)) {
return null;
}
if ($array === range(0, count($array) - 1)) {
return true;
}
$numeric = true;
$keys = array_keys($array);
$count = count($keys);
for ($i = 0; $i < $count; $i++) {
if (!is_numeric($array[$keys[$i]])) {
$numeric = false;
break;
}
}
return $numeric;
}