1. script:
$num = "00445790";
echo $num;
returns:
00445790
2. script
$num = 00445790;
echo $num;
returns:
2351
Can somebody explain why I get 2351 on the second script?
John Conde
Integers that start with zero are consider octal. Because octal integers only use numbers from 0 to 8 everything from the 9 on are ignored.
So 00445790 becomes 004457 which is 2351 in decimal.
来源:https://stackoverflow.com/questions/30629817/weird-output-when-number-starts-with-0