PHP 7 – Removing old style PHP constructors

In new PHP 7, old style PHP 4 constructors will be removed as you can see in this RFC Voting. This voting has started a huge discussion about it on this Sitepoint article and in the wider community.

Generaly, I was tired that people were fighting over this small insignificant thing, so I spent an hour and created this PHP script that will find all old style constructors and convert them to proper __construct constructors. All you need from github repo is index.php.

Example usage:
php index.php /absolute/path/to/your/root/folder/

WARNING: Don’t forget to backup your files before starting script. And make sure that script has read/write rights on the files.

Leave a comment