Dear fellow developers,
I think every year Matt receives a question at WordCamp US – “When will WordPress stop supporting PHP 5.2.17”, and every year the answer is the same – “we’re still thinking about it”.
I think the main reason for not forcing a PHP Upgrade is obvious – outdated hosting providers and outdated servers are holding us back. I think it’s time to stop that.Have a look at this chart from WordPress.org:
PHP 5.2 is only 4.4%, PHP 5.3 is at 11.8%. Those versions have been outdated for quite some time now.
When I was working on Easy Photography Portfolio plugin, I decided that I’m going to take the risk and require PHP 5.4 or higher. I thought I was going to get a complaint or a support ticket every month or two and I was prepared to endure that.
Almost a year has passed – 0 PHP version complaints or support requests. I think I can assume that most modern hosting providers have migrated to PHP 5.4+ by default already.
I think that the PHP versions in that pie are only due to old, outdated websites.
Even if that’s not true, I still think developers should require higher and higher PHP versions. If someone wants your plugin and is running PHP 5.3 or 5.2 – it might be the exact push that they needed to upgrade their server. And while upgrading, they might decide to go for a current PHP version (PHP7) instead of bumping their server just a little – as a result, you could be helping PHP7 adoption overall, and helping your users get the latest, greatest and fastest PHP version!
The time is now
If you’re working on a new plugin/theme – don’t be afraid to require a PHP Version. Require at least PHP 5.4 ( or maybe even 5.6 🤔 ?) in all your future project and use that “new” bracket array syntax, lambda functions, namespaces, PHP traits and whatever else you might enjoy from newer PHP versions.
WordPress is a giant. Giants move slowly, and that’s okay. Individual or small wp shops are small – you can move as fast as you want – you’re not tied to the PHP Version that WordPress supports.