note 82354 added to function.is-int

From: Date: Mon, 07 Apr 2008 17:58:02 +0000
Subject: note 82354 added to function.is-int
Groups: php.notes 
Request: Send a blank email to php-notes+get-138005@lists.php.net to get a copy of this message
function is_natural($natural,$zero=true) { if(ctype_digit($natural)) { if($zero) { $natural_test=(int)$natural; if((string)$natural_test !== $natural) return false; else return true; } else return true; } else return false; } true for ("0","1","2","3",...) false for("-1","01","adS","#@!$%^&*-...","0.7","0,7", "0x12",...) if $zero=false true for("0","00","1","01",...) false("-1","#@!$%^&*-...","adS","0.7","0,7", "0x12",...) ---- Server IP: 82.177.164.100 Probable Submitter: 84.40.178.197 ---- Manual Page -- http://www.php.net/manual/en/function.is-int.php Edit -- https://master.php.net/note/edit/82354 Del: integrated -- https://master.php.net/note/delete/82354/integrated Del: useless -- https://master.php.net/note/delete/82354/useless Del: bad code -- https://master.php.net/note/delete/82354/bad+code Del: spam -- https://master.php.net/note/delete/82354/spam Del: non-english -- https://master.php.net/note/delete/82354/non-english Del: in docs -- https://master.php.net/note/delete/82354/in+docs Del: other reasons-- https://master.php.net/note/delete/82354 Reject -- https://master.php.net/note/reject/82354 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138005) next »