note 72655 added to function.is-numeric

From: Date: Sun, 28 Jan 2007 17:51:44 +0000
Subject: note 72655 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-122296@lists.php.net to get a copy of this message
If you want to check the validity of an integer from user input, use this: <?php function get_int(&$i,$set=false) { if ($set) $j =& $i; else $j = $i; return ((string) $j === (string) $j = (int) $j); } ?> This is the most efficient way that I have found, it will return true on any string or integer variable containing a 32bit signed int. If $set is true, it will also cast the input to int type. ---- Server IP: 83.138.144.80 Probable Submitter: 88.111.53.210 ---- Manual Page -- http://www.php.net/manual/en/function.is-numeric.php Edit -- https://master.php.net/note/edit/72655 Del: integrated -- https://master.php.net/note/delete/72655/integrated Del: useless -- https://master.php.net/note/delete/72655/useless Del: bad code -- https://master.php.net/note/delete/72655/bad+code Del: spam -- https://master.php.net/note/delete/72655/spam Del: non-english -- https://master.php.net/note/delete/72655/non-english Del: in docs -- https://master.php.net/note/delete/72655/in+docs Del: other reasons-- https://master.php.net/note/delete/72655 Reject -- https://master.php.net/note/reject/72655 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122296) next »