What does a leading zero do for a php int?

echo(073032097109032116104101032118101114121032109111100101108032111102032097032109111100101114110032109097106111114032103101110101114097108046);

Essentially, a very large number. Now, why does it output 241872? I know PHP has float handlers. When I remove the leading zero, it functions as expected. What is that leading zero signifying?


If you use a leading zero, the number is interpreted by PHP as an octal number. Thus, a 9 is not a valid part of the number and the parser stops there:

  0730320 (base 8)
=  7 * 8^5 + 3 * 8^4 + 3 * 8^2 + 2 * 8^1
=  7 * 32768 + 3 * 4096 + 3 * 64 + 2 * 8 (base 10)
=  241872 (base 10)

A leading zero indicates an octal integer value


Manual:

Warning

If an invalid digit is given in an octal integer (i.e. 8 or 9), the rest of the number is ignored.

Example #2 Octal weirdness

<?php
var_dump(01090); // 010 octal = 8 decimal
?>

So your number gets cut off after 0730320, which is 241872 in decimal.