#30065 [Csd->Bgs]: integers with leading 0
| From: | tony2001@php.net | Date: | Sun, 12 Sep 2004 04:59:43 +0000 |
| Subject: | #30065 [Csd->Bgs]: integers with leading 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66088@lists.php.net to get a copy of this message | ||
ID: 30065
Updated by: tony2001@php.net
Reported By: agapater at yahoo dot com
-Status: Closed
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: windows xp
PHP Version: 5.0.0
Previous Comments:
------------------------------------------------------------------------
[2004-09-12 01:04:28] agapater at yahoo dot com
Thank you for your quick answer.
------------------------------------------------------------------------
[2004-09-12 00:48:44] eru@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Congratulations, you have discovered the notation for handling octal
numbers ;-)
(see http://www.php.net/manual/en/language.types.integer.php)
------------------------------------------------------------------------
[2004-09-12 00:44:26] agapater at yahoo dot com
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 this bug report at http://bugs.php.net/?id=30065&edit=1