DEV Community

Andrej Rypo
Andrej Rypo

Posted on


php 8 fun

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
Enter fullscreen mode Exit fullscreen mode

See the difference of evaluation in PHP 7 and PHP 8 here:

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)

snakepy profile image

It seems almost like in JavaScript. 💥

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git