note 41115 added to function.sprintf
| From: | www dot feisar dot de at rn2 dot php dot net | Date: | Tue, 30 Mar 2004 15:27:29 +0000 |
| Subject: | note 41115 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67389@lists.php.net to get a copy of this message | ||
watch out when using %d in (s)printf!
this code:
<?php
$x = '13.23';
$x = $x + 123.41;
$x = $x * 100;
echo sprintf("%d = %s \n",$x,$x);
?>
will output
13663 = 13664
which obviously is not true. 13664 would be correct.
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41115
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41115&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41115&report=yes
Search -- http://master.php.net/manage/user-notes.php