note 92984 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Tue, 18 Aug 2009 17:21:49 +0000 |
| Subject: | note 92984 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159603@lists.php.net to get a copy of this message | ||
Note Submitter: petr dot skyba at seznam dot cz
----
czech price format
example:
1158155.66 => 1 158 155,66
1158155.10 => 1 158 155,1
1158155.00 => 1 158 155
( removing trailing zeroes and comma )
<?php
function nice_format($value){
$value = number_format(floatval($value), 2, ',', ' ');
$value = preg_replace("/,?0*$/","", $value);
return $value;
}
?>