RE: [PHP] how do this in a best way?

From: Date: Wed, 16 Apr 2003 05:16:28 +0000
Subject: RE: [PHP] how do this in a best way?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144063@lists.php.net to get a copy of this message
On 16-Apr-2003 Vladimir Galkov wrote: > I need to transform inputed numbers: 1324534566 > 1 324 534 566 (insert > space after every third number)/ How do that with the BEST way? > > <?php $n='1324534566'; echo '<P>&nbsp; cheat solution: ', str_replace(',', ' ', number_format($n)); echo '<P>general solution: ', strrev(str_replace("\r\n", ' ',chunk_split(strrev($n),3))); ?> Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#144063) next »