note 17880 added to function.substr-replace

From: Date: Mon, 31 Dec 2001 08:03:45 +0000
Subject: note 17880 added to function.substr-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-24011@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. -- http://www.php.net/manual/en/function.substr-replace.php http://master.php.net/manage/user-notes.php?action=edit+17880 http://master.php.net/manage/user-notes.php?action=delete+17880 http://master.php.net/manage/user-notes.php?action=reject+17880

« previous php.notes (#24011) next »