Posts tagged with php7

What's new in PHP 8.1

– stitcher.io - submitted by Brent

PHP 8.1 is currently in active development and will probably be released somewhere around the end of November 2021. We already know some features, changes and deprecations, so let's go through them one by one.

Read more [stitcher.io]

Join 9,500+ smart developers

Every month I share what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Typed properties in PHP

– stitcher.io

Brent wrote another nice post on PHP. This time on the upcoming typed hints feature of PHP 7.4.

Typed class properties were added in PHP 7.4 and provide a major improvement to PHP's type system. These changes are fully opt-in and backwards compatible. In this post we'll look at the feature in-depth.

Read more [stitcher.io]

Short closures in PHP

– stitcher.io

Short closures are coming to PHP 7.4. In this blogpost, my colleague Brent exaplins what they look like and how they can be used

Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like array_map or array_filter.

Read more [stitcher.io]

Arrow functions are (probably) coming to PHP 7.4

– wiki.php.net

Exciting times in PHP land. Nikita Popov, Levi Morrison and Bob Weinand have officially proposed a concrete implementation for arrow functions.

Anonymous functions in PHP can be quite verbose, even when they only perform a simple operation. Partly this is due to a large amount of syntactic boilerplate, and party due to the need to manually import used variables. This makes code using simple closures hard to read and understand. This RFC proposes a more concise syntax for this pattern. ... Short closures are critically overdue, and at some point we'll have to make a compromise here, rather than shelving the topic for another few years.

Let's hope this one gets accepted!

Read more [wiki.php.net]

New in PHP 7.4

– stitcher.io

PHP 7.4, which will be released around December 2019, will bring a couple of nice features such as typed properties, preloading, improved type variance, ... In a new post on his blog my colleague Brent gives a nice overview of what to expect

Read more [stitcher.io]

What's new and changing in PHP 7.3

Ayesh Karunaratne made a good summary of the new stuff coming in PHP 7.3 which will be released by the end of the year.

This is a live document (until PHP 7.3 is released as generally available) on changes and new features to expect in PHP 7.3, with code examples, relevant RFCs, and the rationale behind them, in their chronological order.

https://ayesh.me/Upgrade-PHP-7.3

The trailing comma in function and method calls seems nice!

Read more

The List Function & Practical Uses of Array Destructuring in PHP

Sebastian De Deyne wrote a cool blogpost on array destructuring in PHP. Yet another reason to stay up to date with the latest and greatest PHP version.

PHP 7.1 introduced a new syntax for the list() function. I've never really seen too much list() calls in the wild, but it enables you to write some pretty neat stuff.

This post is a primer of list() and it's PHP 7.1 short notation, and an overview of some use cases I've been applying them to.

https://sebastiandedeyne.com/posts/2017/the-list-function-and-practical-uses-of-array-destructuring-in-php

Read more

Symfony and Laravel will require PHP 7 soon

According to Fabien Potencier, lead of the Symfony project, the next major version of Symfony, to be released at then end of 2017, will require PHP 7.

But Laravel will drop PHP 5 support even sooner. Taylor Otwell, the creator of Laravel, announced that Laravel 5.5, to be released in June 2017, will leave PHP 5 behind.

On multiple occasions Taylor et co. have stated that they don't like the strictness that things like scalar and return type hints bring to the table. So I don't expect to see them appear much in Laravel codebase. Smaller syntax improvements like for example the null coalescing operator will almost certainly be used.

A few weeks ago Jordi Boggiano reported that only a miserable 3% of all packages present on Packagist require PHP 7. The best thing about Symfony and Laravel dropping PHP 5 support is that it will send a strong message throughout the entire PHP ecosystem that you shouldn't bother with PHP 5 code anymore. When creating new projects and packages more developers will target PHP 7 as a minimum version as well.

For our PHP and Laravel packages we left PHP 5 behind as soon as PHP 7 was available. Our packages already make extensive use of return type hints, anonymous classes and the null coalescing operator to create more readable (and thus more maintainable) code.

(Fun Scary fact: Wordpress only requires PHP 5.2 ?)

Read more

What's new in PHP 7.1

With PHP 7.1 scheduled to be released next week, it's probably a good idea to go over the new features is offers.

The newest version of PHP – 7.1.0 – is already at RC6 (Release Candidate 6) status, which means it will be out soon. After a huge update that took PHP from 5.6 straight to 7.0 increasing speeds considerably, PHP is now focusing on core language features that will help all of us write better code. In this article I’ll take a look at the major additions and features of PHP 7.1.0 which is just around the bend.

https://kinsta.com/blog/php-7-1-0/

Read more

PHP 7 is gaining ground fast

Jordi Boggiano shared some new stats on PHP version usage he collects via Packagist.

A few observations: 5.3 and 5.4 at this point are gone as far as I am concerned! 5.5 still has a good presence but lost 12% in 6 months which is awesome. 5.6 basically stayed stable as I suspect people jumped from 5.5 to 7 directly probably when upgrading Ubuntu LTS. 7.0 gained 15% and is now close to being the most deployed version, 1 year after release! That should definitely encourage more libraries to require it IMO, and I hope it is good encouragement to PHP internals folks as well to see that people actually upgrade these days :)

It's very cool that PHP 7 is being adopted so quickly. I suspected that it would go down this way. Unfortunately the majority of package creators are still targeting PHP 5. Jordi has this to say on that.

As I wrote in the last update: I would like to encourage everyone to be a bit more aggressive in bumping PHP requirements when tagging new major releases of their libs. Don't forget that the old code does not go away, it's still there to be used by people using legacy PHP versions.

Amen!

Read Jordi's blogpost here: https://seld.be/notes/php-versions-stats-2016-2-edition

Read more