note 34266 added to function.number-format
| From: | webmaster at goatse dot cx | Date: | Sun, 20 Jul 2003 19:10:57 +0000 |
| Subject: | note 34266 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52419@lists.php.net to get a copy of this message | ||
For a simpler way to make number floating, I made this function.
function float($num, $decnum) {
$num = @preg_replace("/[^0-9.]/", "//", $num);
$decnum = @preg_replace("/[^0-9]/", "//", $decnum);
if (($num==NULL) || ($num==FALSE)) $num=0;
if (($decnum==NULL) || ($decnum==FALSE)) $decnum=0;
$floatnum = number_format($num, $decnum, '.', '');
return $floatnum;
}
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34266
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34266&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34266&report=yes