That is because 1 is an integer here and when it is compared to a string 1,2
, this string will be casted to an integer , which returns 1.
How does casting a string 1,2
return 1 ?
echo int('1,2'); // prints 1
So when it is compared to your 1 , this will be obviously returning true
on your var_dump
From the PHP Docs.. (Basic Comparison Test)
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.