note 80356 added to function.is-numeric

From: Date: Fri, 11 Jan 2008 18:31:42 +0000
Subject: note 80356 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-135029@lists.php.net to get a copy of this message
To Elwin van Huissteden, by his answer at 27-Mar-2007 05:05. Your code didnt work (you said not tested it). So i fixed it: <? function my_is_numeric($value) { $american = preg_match ("/^(-){0,1}([0-9]+)(,[0-9][0-9][0-9])*([.][0-9]){0,1}([0-9]*)$/" ,$value) == 1; $world = preg_match ("/^(-){0,1}([0-9]+)(.[0-9][0-9][0-9])*([,][0-9]){0,1}([0-9]*)$/" ,$value) == 1; return ($american or $world); } ?> -the English/American way of writing a float million number: 1,000,000.00 -the global way of writing a float million number: 1.000.000,02 ---- Server IP: 69.147.83.197 Probable Submitter: 200.252.157.118 ---- Manual Page -- http://www.php.net/manual/en/function.is-numeric.php Edit -- https://master.php.net/note/edit/80356 Del: integrated -- https://master.php.net/note/delete/80356/integrated Del: useless -- https://master.php.net/note/delete/80356/useless Del: bad code -- https://master.php.net/note/delete/80356/bad+code Del: spam -- https://master.php.net/note/delete/80356/spam Del: non-english -- https://master.php.net/note/delete/80356/non-english Del: in docs -- https://master.php.net/note/delete/80356/in+docs Del: other reasons-- https://master.php.net/note/delete/80356 Reject -- https://master.php.net/note/reject/80356 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135029) next »