note 110211 deleted from function.is-numeric by googleguy
| From: | googleguy@php.net | Date: | Wed, 03 Oct 2012 02:32:12 +0000 |
| Subject: | note 110211 deleted from function.is-numeric by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191108@lists.php.net to get a copy of this message | ||
Note Submitter: egeakpinar at gmail dot com
----
To check if a string has any number in it
function str_contains_number($test_string) {
$length = strlen($test_string);
for($i = 0; $i < $length; $i++)
{
$current_char = $test_string[$i];
if($current_char >= '0' && $current_char <= '9') {
return true;
}
}
return false;
}