From all of the breaking changes introduced in PHP 8 I think the change to the comparison operator is the most intricate one:
// To be `true` or not to be? That is the question.
'' == 0
'' === 0
'0' == 0
'💩' == 0
'0foo' == 0
See the difference of evaluation in PHP 7 and PHP 8 here:
👉 https://3v4l.org/farC0
I just don't understand how it's possible that I have not encountered a bug because of it yet.
Hopefully, no sensible person is using the equality ==
operator.
Top comments (1)
It seems almost like in JavaScript. 💥