note 15677 added to function.is-int

From: Date: Wed, 26 Sep 2001 09:13:52 +0000
Subject: note 15677 added to function.is-int
Groups: php.notes 
Request: Send a blank email to php-notes+get-18313@lists.php.net to get a copy of this message
I made this function to check if a string has only numeric characters. At first I thought is_int would work for that but it (how odd? hehe) doesn't work on strings (of course). Maybe there's an easyer or better way but this worked for me. function checknrst($nrst) { $allgood=true; for ($k=0; $k<strlen($nrst); $k++) { if (($stdnr[$k]!="0") && ((int)($stdnr[$k])==0)) $allgood=false; } return ($allgood); } -- http://www.php.net/manual/en/function.is-int.php http://master.php.net/manage/user-notes.php?action=edit+15677 http://master.php.net/manage/user-notes.php?action=delete+15677 http://master.php.net/manage/user-notes.php?action=reject+15677

« previous php.notes (#18313) next »