I am having a bit of trouble wrapping my head around this, so I thought I will ask it..
I have this code:
$x="string";
var_dump($x==0); //says true
var_dump($x==true); //says true
var_dump(true==0); //says false
What I understand is:
In 1, `string` gets converted to number, which becomes `0` so condition is true
In 2, `string` is a value, so condition is true
In 3, `true` is not equal to `0` so condition is false
Individually they all make sense, but in a sequence they just don't! I have heard many people say it is because the conditional operator in PHP is not transient
. Can someone explain what that means, and how to make sense of this?