note 41115 deleted from function.sprintf by sniper
| From: | sniper@php.net | Date: | Thu, 15 Jul 2004 15:59:33 +0000 |
| Subject: | note 41115 deleted from function.sprintf by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73306@lists.php.net to get a copy of this message | ||
Note Submitter: www.feisar.de
----
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.