note 19068 added to function.number-format

From: Date: Thu, 14 Feb 2002 18:07:47 +0000
Subject: note 19068 added to function.number-format
Groups: php.notes 
Request: Send a blank email to php-notes+get-26617@lists.php.net to get a copy of this message
For many europeans like me, it is probably handy to have a EURO amount formatted to number_format(), and then without the decimals. For most europeans this would mean dots in the thousands, and not comma's, so to make your life easier, make the full monkey, then do the regular expression to get the 2 decimals and the final comma off. Hope you find it useful. $amount='300000'; $amount_new = number_format($amount, 2, ",", "."); $amount_new =substr($amount_new, 0 , -3); echo "€ $amount_new"; that would display EURO(sign) 300.000 -- http://www.php.net/manual/en/function.number-format.php http://master.php.net/manage/user-notes.php?action=edit+19068 http://master.php.net/manage/user-notes.php?action=delete+19068 http://master.php.net/manage/user-notes.php?action=reject+19068

« previous php.notes (#26617) next »