note 110033 modified in function.ctype-digit by danbrown
| From: | danbrown@php.net | Date: | Thu, 13 Sep 2012 16:34:24 +0000 |
| Subject: | note 110033 modified in function.ctype-digit by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190721@lists.php.net to get a copy of this message | ||
Try this. If only numbers return the string, otherwise boolean
FALSE <?php if (false !==
filter_var($sText, FILTER_VALIDATE_INT)) { echo 'yes, only
numbers'; } ?>
--was--
Try this.
If only numbers return the string, otherwise boolean FALSE
<?php
if (false !== filter_var($sText, FILTER_VALIDATE_INT)) {
echo 'yes, only numbers';
}
http://php.net/manual/en/function.ctype-digit.php