Re: Correct number format (curency)

From: Date: Thu, 20 Feb 2003 15:05:16 +0000
Subject: Re: Correct number format (curency)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136363@lists.php.net to get a copy of this message
> Example > > 1.000,00 > 1000.00 > 1,000.00 > > I would like to convert those to a single format > 1000.00 <? function money(&$money) { /* written by bas@startpunt.cc */ $money=str_replace(array(',','.'),'',$money); $money=substr($money,0,strlen($money)-2).'.'.substr($money,-2); } $money='1.000,00'; money($money); echo $money."\n"; $money='1000.00'; money($money); echo $money."\n"; $money='1,000.00'; money($money); echo $money."\n"; ?>

« previous php.general (#136363) next »