note 24425 added to function.floatval
| From: | nik at orfanos dot org | Date: | Thu, 15 Aug 2002 19:24:58 +0000 |
| Subject: | note 24425 added to function.floatval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35085@lists.php.net to get a copy of this message | ||
In case you are not running PHP 4.2+ you can use this function:
function floatval( $strValue )
{
$floatValue = preg_replace( "/[^0-9\.]*/", "", $strValue );
return $floatValue;
}
It's very simple, but it works and it should help someone. Enjoy.
--
http://www.php.net/manual/en/function.floatval.php
http://master.php.net/manage/user-notes.php?action=edit+24425
http://master.php.net/manage/user-notes.php?action=delete+24425
http://master.php.net/manage/user-notes.php?action=reject+24425