note 27984 added to function.sprintf
| From: | carl at rack1 dot php dot net | Date: | Sat, 28 Dec 2002 15:40:29 +0000 |
| Subject: | note 27984 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41382@lists.php.net to get a copy of this message | ||
Correction to the above (d'oh!):
You need to use an intermediary for some reason, e.g.
$v = sprintf("%.3f", (float)$v);
$v = ereg_replace("\\.0+\$|(\\.[^0]+)0+\$", "\\1", $v);
--
http://www.php.net/manual/en/function.sprintf.php
http://master.php.net/manage/user-notes.php?action=edit+27984
http://master.php.net/manage/user-notes.php?action=delete+27984
http://master.php.net/manage/user-notes.php?action=reject+27984