Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sebastian De Deyne:
The List Function & Practical Uses of Array Destructuring in PHP
May 15, 2017 @ 10:26:37

Sebastian De Deyne has written up a post to his site spotlighting PHP's list function and showing how it can be used for "array destructuring" and how recent changes in PHP 7.1.x make it more useful.

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.

He starts with a basic introduction to the list function and how it assigns out variables based on an array. He then shows examples of the updates that came with PHP 7.1, allowing you to specify the key from an array to more selectively extract only the value you want. Three "exhibits" are then provided, showing actual use cases for this functionality: basicunpacking examples, creating tuples and handling multiple return values.

tagged: list function use array destructuring php71 functionality tutorial tuple returnvalue

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

PHP.net:
PHP 7.1.5 Released
May 12, 2017 @ 11:47:16

On the main PHP.net site they've posted the announcement about the latest release in the PHP 7.1.x series: PHP 7.1.5. This is a bugfix release and problems were fixed in:

  • core functionality
  • date handling
  • GD graphics functionality
  • internationalization
  • OpenSSL
  • phar creation

You can download this latest release from either the main downloads page (source releases) or windows.php.net for the Windows binaries. If you're curious about the full set of changes, you can check out the full Changelog for this release.

tagged: language release bugfix php71

Link: http://php.net/archive/2017.php#id2017-05-11-2

PHP.net:
PHP 7.1.4 Released
Apr 14, 2017 @ 09:23:58

On the main PHP.net site they've posted an announcement about the latest release in the PHP 7.1.x series - PHP 7.1.4:

The PHP development team announces the immediate availability of PHP 7.1.4. Several bugs have been fixed. All PHP 7.1 users are encouraged to upgrade to this version.

Bugfixes in this release include changes in Core, Apache, DOM, Opcache and OpenSSL functionality. As always, this latest release can be downloaded from the main downloads page on the PHP.net site (source) and windows.php.net for the Windows binaries. If you'd like to view the full list of changes and see links to the bugs they fix check out the full Changelog.

tagged: language release bugfix php71

Link: http://php.net/index.php#id2017-04-13-2

PHP.net:
PHP 7.1.3 Released
Mar 17, 2017 @ 11:17:21

The PHP.net site has posted an announcement about the latest release in the PHP 7.1.x series - PHP 7.1.3:

The PHP development team announces the immediate availability of PHP 7.1.3. Several bugs have been fixed. All PHP 7.1 users are encouraged to upgrade to this version.

Bugs fixed in this version include changes in core code, Apache support, GD image handling, OpenSSL changes and correcting bugs in the standard libraries. As always you can download this latest release either from the main PHP.net site (source) or from windows.php.net (Windows binaries).

tagged: language release bugfix php71

Link: http://php.net/index.php#id2017-03-16-2

PHP.net:
PHP 7.1.2 Released
Feb 20, 2017 @ 12:15:32

The official PHP.net site has announced the release of the latest version in the PHP 7.1.x series: PHP 7.1.2:

The PHP development team announces the immediate availability of PHP 7.1.2. Several bugs have been fixed. All PHP 7.1 users are encouraged to upgrade to this version.

Bugs fixed include changes for DOM handling, FastCGI, hashing (adding http://php.net/hash_hkdf function), MySQL, OpenSSL and a good number of other locations. You can view the Changelog for the complete list. As always you can get this latest version from the main downloads page (source release) or windows.php.net for the Windows binaries.

tagged: language version release php71 minor bugfix

Link: http://php.net/index.php#id2017-02-17-1

Sameer Borate:
Handling multiple exceptions in PHP 7.1
Feb 14, 2017 @ 09:40:16

Sameer Borate has a new post to his site today showing how you can handle multiple exceptions in PHP 7.1, the latest release in the PHP 7.x series.

Exception handling is one of the ways in which modern languages handle errors. PHP usually handles exception in a separate catch block for each different type of exception. Below is a example exception code that uses three custom exceptions ‘MyFooException’, ‘MyBarException’ and ‘MyBazException’ that is later handled in a ‘try’ block.

He includes a bit of code showing the "old way" of doing it with multiple catch statements, one for each type of exception. With PHP 7.1 however, you can collapse all of those down into a single catch statement and type hint each type you want caught (pipe delimited). This can make for much cleaner code and a lot less repetition in your error/exception handling.

tagged: multiple exception php71 try catch single tutorial

Link: http://www.codediesel.com/php/handling-multiple-exceptions-in-php-7-1/

Sameer Borate:
New features in PHP 7.1
Feb 13, 2017 @ 10:57:45

The PHP 7.1.x releases are some of the latest versions of the language. There's plenty of new features that came along with this new release. In this new post to his CodeDiesel blog Sameer Borate looks at some of these new features (including code snippets to illustrate).

The PHP development team announced PHP 7.1.0 on 01 Dec 2016. This release is the first point release in the 7.x series. There are a few features – like the void return type – which have been introduced. Below are a few new selected features in PHP 7.1.

In the post he covers:

  • void functions (return type)
  • nullable types
  • symmetric array destructuring
  • class constant visibility

For each, code samples are provided and some of the benefits (and limitations) that come along with them.

tagged: feature php71 void nullable array class constant summary

Link: http://www.codediesel.com/php/new-features-in-php-7-1/

PHP.net:
PHP 7.1.1 Released
Jan 19, 2017 @ 12:30:26

On the main PHP.net site they've posted the announcement today about the release of the latest version in the PHP 7.1.x series: PHP 7.1.1:

The PHP development team announces the immediate availability of PHP 7.1.1. Several bugs have been fixed. All PHP 7.1 users are encouraged to upgrade to this version.

Updated in this release are bugs in the language core, the CLI handling, namespacing with DOM and a few various security-related issues. You can find out about the rest of the changes and links to their respective bugs in the Changelog. As always, you can download this latest version from the main downloads page or windows.php.net for the Windows binaries.

tagged: language release bugfix php71

Link: http://php.net/index.php#id2017-01-19-1

Michelangelo van Dam:
Sessions in PHP 7.1 and Redis
Dec 19, 2016 @ 12:09:17

Michelangelo van Dam has a new post to his site looking at using Redis for PHP sessions storage and changes related to the use of PHP 7.1.

In case you have missed it, PHP 7.1.0 has been released recently. Now you can’t wait to upgrade your servers to the latest and greatest PHP version ever. But hold that thought a second…

With PHP 7 lots of things have changed underneath the hood. But these changed features can also put unexpected challenges on your path. [...] One of these challenges that we faced was getting PHP 7.1 to play nice storing sessions in our Redis storage. In order to store sessions in Redis, we needed to install the Redis PHP extension that not only provides PHP functions for Redis, but also installs the PHP session handler for Redis.

When he installed the extension, the latest version (redis-3.1.0), he was given an error message about a failure to read the session data. He shares a bit of code he used to try to debug and diagnose the problem (and a Docker environment) that still resulted in the error. Ultimately they narrowed it down and discovered that it was the Redis extensions causing the problems. Downgrading it from 3.1.0 to 3.0.0 solved the issue right away.

tagged: session redis php71 extension tutorial troubleshoot error connection

Link: http://www.dragonbe.com/2016/12/sessions-in-php-71-and-redis.html

Symfony Finland:
PHP 7.1 vs. 7.0 performance benchmarks with Symfony
Dec 12, 2016 @ 10:04:09

On the Symfony Finland site they've post together a post sharing some benchmark results of Symfony on PHP 7.0 versus 7.1, the most recent major release of the PHP language with some improvements of its own.

PHP 7.1 was launched on December 1st 2016. This was the first minor release after the release of 7.0 a year ago. PHP 7.0 was a revolutionary product, especially when it comes to memory usage and performance. PHP 7.1 is a more modest upgrade that brings new features and improved performance. But how much has performance improved from a year back?

The benchmarking uses the eZ Platform demo running a full CMS similar to the previous benchmarking done in 2015. The checks were run using:

  • a "clean" environment (no caching, PHP-FPM just restarted and no APC cache)
  • standard requests running in development mode
  • more requests but this time in production mode

The post shares the results with a few graphs showing them in terms of response time for both sequential and concurrent page requests.

tagged: php70 php71 benchmark symfony ezplatform cms results

Link: https://www.symfony.fi/entry/php-7-1-vs-7-0-benchmarks-symfony