Why is the output to this 20, and not 22? Seeing as you\'re adding 10 + 0xA(which is 10 in HEX) + 2.
$a = 010;
$b = 0xA;
$c = 2;
print $a + $b + $c;
Output
See the manual for numbers:
To use octal notation, precede the number with a 0 (zero). To use hexadecimal notation precede the number with 0x. To use binary notation precede the number with 0b.
010
is an octal number (it starts with a 0
which isn't followed by a decimal point), which is 8
in decimal.