note 47694 deleted from function.is-numeric by nlopess
| From: | nlopess@php.net | Date: | Sat, 24 Sep 2005 07:54:06 +0000 |
| Subject: | note 47694 deleted from function.is-numeric by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95693@lists.php.net to get a copy of this message | ||
Note Submitter: admin at carichat dot net
----
This Post Responds To mdallaire at virtuelcom dot com.
If You Want To Check To See If A Variable Has Not Letters, PHP Has A Beautiful Built-In Feature
Which Allows You To Do So:
<?php
$myString = "0123456789z";
if(ctype_digit($myString))
{
echo "The String $myString Contains Only Numeric Chars.";
}
else
{
echo "The String $myString Does Not Contain Only Numeric Chars.";
}
//Outputs The String 0123456789z Does Not Contain Only Numeric Chars.
?>
The Full ctype Listing:
ctype_alnum
ctype_alpha
ctype_cntrl
ctype_digit
ctype_graph
ctype_lower
ctype_print
ctype_punct
ctype_space
ctype_upper
ctype_xdigit