PHP7.4 has silently ended The War…

Jerzy Zawadzki
2 min readMar 8, 2021

--

It’s been almost 4 months with PHP8. I’m ending my first project done from scratch with this version. My favorite change in PHP done on that release turned out to be constructor property promotion. It really clears up that header part on every class.

However, I just noticed, that there was MUCH MORE IMPORTANT CHANGE in PREVIOUS VERSION (PHP7.4) that no one (* that I know of) is talking about — and we should: The War has come to the end!

Since I remember, and I’ve started doing PHP on version 4, there was one big discussion on PHP performance:

What is faster? Single quotes with concatenation of variables or double quotes with variable expansion:

'I am ' . $age .' years old
or
"I am $age years old"

Of course, in modern applications such differences doesn’t have any real value in terms of performance — we should consider also e.g. readability, but answering that question: concatenation with single quotes string was a bit faster in PHP7.3:

You can see that with 100 000 000 concats we have 2sec difference on my computer in favor to concatenation.

BUT NO MORE!

PHP7.4 has made this equal even with small advantage to magic strings

Finally! Thanks PHP, we can now go back to important stuff.

P.S. This post is meant to be somehow comedian — don’t come to me if you have different results on your computer — I don’t care.

--

--