#30065 [NEW]: integers with leading 0
| From: | agapater at yahoo dot com | Date: | Sat, 11 Sep 2004 22:44:27 +0000 |
| Subject: | #30065 [NEW]: integers with leading 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-66070@lists.php.net to get a copy of this message | ||
From: agapater at yahoo dot com
Operating system: windows xp
PHP version: 5.0.0
PHP Bug Type: Unknown/Other Function
Bug description: integers with leading 0
Description:
------------
sometimes php doesn't seem to consider zeros in front of an integer, (like
01 == 1, 02 == 2) but sometimes the results are unexpected.
Reproduce code:
---------------
$numbers =
array(01,02,03,04,05,06,07,08,09,10,001,002,003,004,005,006,007,008,009,010,
011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 0001, 0002, 0003, 0004,
0005, 0006, 0007, 0008, 0009, 00010);
foreach($numbers as $number) print $number.",";
Expected result:
----------------
1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,1,2,3,4,5,6,7,8,9,10,
Actual result:
--------------
1,2,3,4,5,6,7,0,0,10,1,2,3,4,5,6,7,0,0,8,9,10,11,12,13,14,15,1,1,16,1,2,3,4,5,6,7,0,0,8,
--
Edit bug report at http://bugs.php.net/?id=30065&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30065&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30065&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30065&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30065&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30065&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30065&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30065&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30065&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30065&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30065&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30065&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30065&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30065&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30065&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30065&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30065&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30065&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30065&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30065&r=mysqlcfg