These days I discovered this weird code fragment "10" == "0xa"
which evaluates to true. The best which I was able to find in the documentation was about Type Juggling:
a variable's type is determined by the context in which the variable is used
But I don't see any integer context in that code fragment. While asking around people seem to accept that as a feature. One explanation I'm hearing is that PHP will compare them as numbers. So I did some number comparison for some valid expressions of 10 (with PHP-5.6.5):
<?php
var_dump(
0b1010, "10" == "0b1010", // false
012, "10" == "012", // false
0xa, "10" == "0xa", // true
1E+1, "10" == "1E+1", // true
1e1, "10" == "1e1", // true
10.0, "10" == "10.0", // true
+10, "10" == "+10" // true
);
Where is this behaviour documented in the manual?
Edit: Please understand that question in the context of the example code. This should emphasize the inconsistency between the binary and octal representation vs. the rest.
If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically.
(my emphasis)
EDIT
A numeric sting is one that will return a Boolean true
from the is_numeric() function
Finds whether the given variable is numeric. Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part. Thus +0123.45e6 is a valid numeric value. Hexadecimal (e.g. 0xf4c3b00c), Binary (e.g. 0b10100111001), Octal (e.g. 0777) notation is allowed too but only without sign, decimal and exponential part.