note 11924 modified in function.substr-replace.php by jmcastagnetto

From: Date: Tue, 13 Mar 2001 23:12:05 +0000
Subject: note 11924 modified in function.substr-replace.php by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-12368@lists.php.net to get a copy of this message
[Editor's note: for a much simpler solution, use number_format()] I had a situation in which I needed to add a comma to the third position of a number(the price of something). <p> $price = "12000";<br> $price = substr_replace ($price, ',', -3, 0)";<br> the result would be 12,000<p> the -3 counts from right to left. a regular 3 would count from left to right I hope this helps... http://www.php.net/manual/function.substr-replace.php.php

« previous php.notes (#12368) next »