PHP now upgraded to 5.6 in Quickstart

Authored by

VIP just merged a PR which upgraded PHP to 5.6 in Quickstart. This is an upgrade from 5.4. With Quickstart being upgraded to 5.6, this should be a signal that we’re now in the clear to use any PHP 5.6 features (and 5.5 features) in our plugins.

The first useful feature that comes to mind for us is to use with this upgrade are generators: we can use generators to automate pagination of large datasets, which is a VIP requirement. We could get around the limitation of only querying 100 rows at a time from the DB by using a PHP generator. See example gist.

See also this post on Alternative Post Loops for some other great ideas on how generators can make The Loop in classic WordPress much nicer to work with.

Another useful feature is the addition of the finally block to try/catch statements.

What other features in 5.5/5.6 stand out to you which are useful in a WordPress/VIP context?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.