note 106440 added to function.intval

From: Date: Wed, 09 Nov 2011 15:48:10 +0000
Subject: note 106440 added to function.intval
Groups: php.notes 
Request: Send a blank email to php-notes+get-184354@lists.php.net to get a copy of this message
inval work well with numbers except the kind: intval("10.2e+2") which gives 10 the trick around is to use the following function: function smart_val($string) { eval("\$number=$string;"); return $number; } Doing smart_val("10.2e+2") gives 1020 ---- Server IP: 62.2.182.223 Probable Submitter: 81.221.81.207 ---- Manual Page -- http://www.php.net/manual/en/function.intval.php Edit -- https://master.php.net/note/edit/106440 Del: integrated -- https://master.php.net/note/delete/106440/integrated Del: useless -- https://master.php.net/note/delete/106440/useless Del: bad code -- https://master.php.net/note/delete/106440/bad+code Del: spam -- https://master.php.net/note/delete/106440/spam Del: non-english -- https://master.php.net/note/delete/106440/non-english Del: in docs -- https://master.php.net/note/delete/106440/in+docs Del: other reasons-- https://master.php.net/note/delete/106440 Reject -- https://master.php.net/note/reject/106440 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184354) next »