note 84590 added to function.floatval

From: Date: Mon, 21 Jul 2008 01:07:33 +0000
Subject: note 84590 added to function.floatval
Groups: php.notes 
Request: Send a blank email to php-notes+get-142373@lists.php.net to get a copy of this message
Most of the functions listed here that deal with $ and , are unnecessarily complicated. You can use ereg_replace() to strip out ALL of the characters that will cause floatval to fail in one simple line of code: <? $output = floatval(ereg_replace("[^-0-9\.]","",$input)); ?> ---- Server IP: 209.41.74.194 Probable Submitter: 71.58.146.178 ---- Manual Page -- http://www.php.net/manual/en/function.floatval.php Edit -- https://master.php.net/note/edit/84590 Del: integrated -- https://master.php.net/note/delete/84590/integrated Del: useless -- https://master.php.net/note/delete/84590/useless Del: bad code -- https://master.php.net/note/delete/84590/bad+code Del: spam -- https://master.php.net/note/delete/84590/spam Del: non-english -- https://master.php.net/note/delete/84590/non-english Del: in docs -- https://master.php.net/note/delete/84590/in+docs Del: other reasons-- https://master.php.net/note/delete/84590 Reject -- https://master.php.net/note/reject/84590 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142373) next »