I have the following PHP code:
$a = "5";
$b = array("position"=>1);
var_dump("5" <= $b);
var_dump("5" <= "Array");
var_dump("Z" <= $b);
var_dump("Z" <= "Array");
the result is:
boolean true
boolean true
boolean true
boolean false
We know that array is converted to the string array
. What's actually happening during the conversion? Why are the results different in the cases below?
var_dump("Z" <= $b); // (in this case array convert to string "array")
var_dump("Z" <= "Array"); // (in this case string "Array" )
But the result is different. Why?