note 109083 added to function.is-numeric
| From: | jeffvanhees at gmail dot com | Date: | Tue, 19 Jun 2012 17:21:01 +0000 |
| Subject: | note 109083 added to function.is-numeric | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188698@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 69.147.83.197
Probable Submitter: 217.121.162.152
----
Manual Page -- http://www.php.net/manual/en/function.is-numeric.php
Edit -- https://master.php.net/note/edit/109083
Del: integrated -- https://master.php.net/note/delete/109083/integrated
Del: useless -- https://master.php.net/note/delete/109083/useless
Del: bad code -- https://master.php.net/note/delete/109083/bad+code
Del: spam -- https://master.php.net/note/delete/109083/spam
Del: non-english -- https://master.php.net/note/delete/109083/non-english
Del: in docs -- https://master.php.net/note/delete/109083/in+docs
Del: other reasons-- https://master.php.net/note/delete/109083
Reject -- https://master.php.net/note/reject/109083
Search -- https://master.php.net/manage/user-notes.php