note 86356 added to function.is-int
| From: | WryelCovo-ryryel | Date: | Tue, 14 Oct 2008 18:53:12 +0000 |
| Subject: | note 86356 added to function.is-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145358@lists.php.net to get a copy of this message | ||
<?
function onlyNumbers($string){
//Esta função limpa a url e conserva apenas os numeros
//This function clean all other than numbers
$string = preg_replace("/[^0-9]/", "", $string);
return (int) $string;
}
echo $test = onlyNumbers("as87d68a6db8a7d686dx8a6dx"); //2147483647
echo "<br/>";
echo onlyNumbers("xn89d9x797d9a8x7-"); //899797987
echo "<br/>";
if(is_int($test)){
echo "Is int ! - Ã inteiro !"; // This OK !
} else {
echo "Not int ! - Não é inteiro";
}
?>
----
Server IP: 81.92.192.129
Probable Submitter: 201.0.203.119
----
Manual Page -- http://www.php.net/manual/en/function.is-int.php
Edit -- https://master.php.net/note/edit/86356
Del: integrated -- https://master.php.net/note/delete/86356/integrated
Del: useless -- https://master.php.net/note/delete/86356/useless
Del: bad code -- https://master.php.net/note/delete/86356/bad+code
Del: spam -- https://master.php.net/note/delete/86356/spam
Del: non-english -- https://master.php.net/note/delete/86356/non-english
Del: in docs -- https://master.php.net/note/delete/86356/in+docs
Del: other reasons-- https://master.php.net/note/delete/86356
Reject -- https://master.php.net/note/reject/86356
Search -- https://master.php.net/manage/user-notes.php