Edit report at https://bugs.php.net/bug.php?id=61293&edit=1
ID: 61293 Comment by: anon at anon dot anon Reported by: donmillhofer at yahoo dot com Summary: assigning 09 to variable Status: Not a bug Type: Bug Package: Variables related Operating System: Windows Vista PHP Version: 5.3.10 Block user comment: N Private report: N New Comment: It's been a bug for 10+ years. To this day nobody at PHP is smart enough to turn it into a syntax error condition, like it would be in a good or semi-good language. Previous Comments: ------------------------------------------------------------------------ [2012-03-05 18:53:54] ras...@php.net Yes, you have discovered octal notation. http://www.php.net/manual/en/language.types.integer.php ------------------------------------------------------------------------ [2012-03-05 18:24:52] donmillhofer at yahoo dot com Description: ------------ My concern is that PHP treats the handling of variable assignment inconsistently. For example if I assign 01 to a variable $i01 the result will be an int 1, the same as if I had assigned 1 to the variable. This works for values of 01,02,03,04,05,06, and 07. However 08 and 09 are assigned as 0! See repeatable test below. Test script: --------------- Assign variables: $s09 = '09'; $c09 = (integer) '09'; $i09 = 09; Result of var_dump($s09.' / '.$c09.' / '.$i09); string '09 / 9 / 0' Assign variables: $s07 = '07'; $c07 = (integer) '07'; $i07 = 07; Result of var_dump($s07.' / '.$c07.' / '.$i07); string '07 / 7 / 7' And when I just dump the $iXX variable I get: var_dump($i09); Result int 0 var_dump($i07); Result int 7 This looks like a bug to me. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61293&edit=1