note 91322 added to function.is-integer

From: Date: Fri, 05 Jun 2009 16:55:39 +0000
Subject: note 91322 added to function.is-integer
Groups: php.notes 
Request: Send a blank email to php-notes+get-156401@lists.php.net to get a copy of this message
PHP lacks of a function to know if a given string is or not a numeric one: function isdigit($c) { if ( $c>'0' && $c<'9' ) return(true); else return (false); } function isnumeric($s) { $numeric=true; for ($i=0;$i<strlen($s);$i++) { $ch=substr($s,$i,1); if (!isdigit($ch)) { $numeric=false; break; } } return($numeric); } $s="123xx567"; if (isnumeric($s)) { print ("is numeric"); } else print ("is not numeric"); ---- Server IP: 69.147.83.197 Probable Submitter: 201.236.222.194 ---- Manual Page -- http://www.php.net/manual/en/function.is-integer.php Edit -- https://master.php.net/note/edit/91322 Del: integrated -- https://master.php.net/note/delete/91322/integrated Del: useless -- https://master.php.net/note/delete/91322/useless Del: bad code -- https://master.php.net/note/delete/91322/bad+code Del: spam -- https://master.php.net/note/delete/91322/spam Del: non-english -- https://master.php.net/note/delete/91322/non-english Del: in docs -- https://master.php.net/note/delete/91322/in+docs Del: other reasons-- https://master.php.net/note/delete/91322 Reject -- https://master.php.net/note/reject/91322 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156401) next »