WordPress To Move to PHP 5.6+

WordPress 5.2 is due out at the end of April, and wit that release the minimum recommended version of PHP will be PHP 5.6.

Minimum PHP Version update

For most plugins this is a non-issue. While we recommend you update your “Requires PHP:” version in your readme.txt, this won’t change the functionality of your code. That field is a minimum version, so if your code works with 7.0 and up, you can set it to `Requires PHP: 7.0` and that will cover 7.1 and 7.2

Also keep in mind, this doesn’t change our policy on PHP versioning, which is to say we still do not have an official version requirement for PHP in your plugins. If you want to support 5.6 forever, feel free. If you want to require 7.1 and up, again, go for it.

You can use a compare to do the basic check:

version_compare( PHP_VERSION, '5.6', '<' )

And remember the goal for your plugin is “Don’t break things for users.” Stop them from getting fatal errors, and don’t run your plugin if you know it can’t work.

#php