note 109910 deleted from function.ctype-digit by danbrown
| From: | danbrown@php.net | Date: | Sun, 02 Sep 2012 17:09:42 +0000 |
| Subject: | note 109910 deleted from function.ctype-digit by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190427@lists.php.net to get a copy of this message | ||
Note Submitter: DomiX
----
Hi Tim,
since PHP 5.2 you can use the filter_var() function
<?php
//only digits (0-9) are allowed, integer and string
if (false !== filter_var($iValue, FILTER_VALIDATE_INT)) {
//return $iValue if characters are only digits
//or boolean FALSE if not
}