note 57400 added to function.number-format
| From: | Robo at osu1 dot php dot net | Date: | Mon, 03 Oct 2005 09:26:36 +0000 |
| Subject: | note 57400 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96256@lists.php.net to get a copy of this message | ||
I've found the weirdest bug in PHP:-
<?php
// string value should still be ok
$weirdValue = '1762.00';
// set to uk price format
$weirdValue = number_format($weirdValue, 2, '.', ',');
// this is fine
echo $weirdValue;
// but this goes to 1.00 if you accidentally set this twice
echo number_format($weirdValue, 2, '.', ',')
?>
The second time you set number_format on this value it sets it to 1.00, i realise that this is a
string and its unlikely that this can happen but it still happened to one of my customer and it was
not good!!
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57400
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57400&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57400&report=yes
Search -- http://master.php.net/manage/user-notes.php