ID: 25864
Comment by: tony2001 at phpclub dot net
Reported By: heppevonhambach at web dot de
Status: Open
Bug Type: Unknown/Other Function
Operating System: linux
PHP Version: Irrelevant
New Comment:
pay attention:
var_dump($n); will output float(1234567890120).
i.e. your integer were automagically converted to float.
so you need to use:
$s = sprintf( "%0{$nL}.0f",$n );
to get expected result.
look here for more info:
http://www.php.net/manual/en/language.types.integer.php
Previous Comments:
------------------------------------------------------------------------
[2003-10-14 09:14:13] heppevonhambach at web dot de
Description:
------------
looks like sprintf has problems with big numbers
Reproduce code:
---------------
$n = 1234567890123;
$nL = 17;
$s = sprintf( "%0{$nL}d",$n );
Expected result:
----------------
00001234567890123
Actual result:
--------------
00000001912276171
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25864&edit=1