note 109083 deleted from function.is-numeric by crell
| From: | crell@php.net | Date: | Mon, 18 Apr 2022 14:55:20 +0000 |
| Subject: | note 109083 deleted from function.is-numeric by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218273@lists.php.net to get a copy of this message | ||
Note Submitter: jeffvanhees at gmail dot com
----
Function for checking all the values in an array for being numeric:
<?php
function is_numeric_array($array) {
foreach ($array as $key => $value) {
if (!is_numeric($value)) return false;
}
return true;
}
$array_not_numeric = array('1', '2', 3, 'a'); // returns false
$array_numeric = array('1', '2', 3, 4); // returns true
?>