I\'m trying to build a php function and discovered some weird behavior and I can\'t even formulate a proper question, so if anyone can explain what is going on, I would appr
Integer literals starting with 0
are interpreted base 8. Your second $x
has the value 83. See the manual on integers for details.
The intval()
function lets you specify the base if you're reading a user string.
If we're talking about literals, in PHP the literal 0
is decimal, while in C and C++ it is octal. It's the little differences that make life fun.