note 107339 deleted from function.money-format by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 21:25:41 +0000 |
| Subject: | note 107339 deleted from function.money-format by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187884@lists.php.net to get a copy of this message | ||
Note Submitter: Raymond
----
Here's a little fix to Rafael M. Salvioni money_format() function for Windows to display
positive values
<?php
// Replace the line containing:
case $locale["{$letter}_sign_posn"] == 0:
$prefix = '(';
$suffix = ')';
break;
// With:
case $locale["{$letter}_sign_posn"] == 0:
if ($positive) $prefix = $suffix = ' ';
else {
$prefix = '('; $suffix = ')';
}
break;
// example:
$mf = '%!(#10i';
$number = 12345;
echo money_format($mf, $number). "<br />\n";
echo money_format($mf, $number*-1) . "\n";
?>