note 15820 deleted from function.is-int by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 23:35:06 +0000 |
| Subject: | note 15820 deleted from function.is-int by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23582@lists.php.net to get a copy of this message | ||
I`m using this function... ^o^
<?
/*
made by zica ^^v
*/
function isInt( $val ) {
$isInt = true;
for ($i=0 ; $i<strlen($val) ; $i++) {
$chr = ord(substr($val, $i, 1));
if(!($chr >= ord('0') && $chr <= ord('9'))) {
$isInt = false;
break;
}
}
return $isInt;
}
$a = 10;
$b = '10';
$c = '1a0';
echo isInt($a); //true
echo isInt($b); //true
echo isInt($c); //false
### usage ###
if(isInt($a) == true) echo "This is Integer";
else echo "This is not Integer";
?>
Is this useful? ^^;;
If there is bugs, plz mail to me. ^^
Bye yo~