note 15677 rejected from function.is-int by zak

From: Date: Wed, 26 Sep 2001 16:55:00 +0000
Subject: note 15677 rejected from function.is-int by zak
Groups: php.notes 
Request: Send a blank email to php-notes+get-18336@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); }

« previous php.notes (#18336) next »