note 17880 deleted from function.substr-replace by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 12:08:37 +0000 |
| Subject: | note 17880 deleted from function.substr-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24252@lists.php.net to get a copy of this message | ||
for transform a numbre string in a price, example:
the number 50000000000 to 50,000,000,000.
you can use this script that i'm create:
---------------------------
<?PHP
$number = 50000000;
$number_lenght = strlen($number);
$n = 3;
$c = -3;
while ($number_lenght > $n)
{
$number = substr_replace ($number,',',$c,0);
$n = $n + 3;
$c = $c - 4;
}
print $number; // this must show 50,000,000.
//IMPORTANT: i dont know why, but the number_lenght can't be more big than 14 chars, for
example 12345678901234.
?>
------------------------------
I really hope that help you, and sorry my english, i'm a spanish boy.