This week we finally moved to PHP 7.4 in production at work. The upgrade has been the most anticipated (by me) since PHP 7.
The new hotness of short functions, typed properties, not to mention improved performance by file preloading, array spread syntax, null coalesce and a host of other improvements!
The only caveats we had upgrading were a few packages were fixed to PHP 7.3 (these have since been upgraded) and we require php-redis extension which is now installed with PECL.
Moving to production went fairly smoothly, to say we're still reliant on Chef and AWS Opsworks which both seem pretty outdated stacks for 2020 (hoping to move to containers soon!)
I really like the language improvements, feels like we're coming more mature as a language and taking inspiration from JavaScript, Java and others. It will be interesting to see the future development and what the future holds for PHP!
Have you upgraded yet? If so, what's your favourite new feature/improvement? If not, what's stopping you?!
Top comments (4)
I have problem with “segmentation fault” in php-fpm. I cannot reproduce it. It just happens sometimes. It’s defiantly related to opcache somehow. I hope I’ll manage manage with it🙂
Oh dear, I used to have seg fault issues years ago upgrading to PHP 7.0, thankfully haven't had any since! Hope it gets resolved for you soon.
I always prefer LTS versions, less bugs, less unexpected crap happening. But I would love to use PHP7.4 tought, especially Typed Variables.
I think all versions of PHP are supported for 2 years now: php.net/supported-versions.php
I'm not sure any of them are LTS any more?
Typed properties are nice, I like that you have to be explicit if a property could also be
null
too, for examplewas perfectly legal but you never knew if $bar was a
Bar
ornull
.Now if I have
it will throw a TypeError if I try to construct a new instance of
Foo
with a null value for $bar. To handle this I change the type to be?Bar
like so:This then forces me to think when using
$this->bar
that the value could benull
and handle appropriately!