PHP 7 backwards compatibility library for mysql and ereg functions

The very commonly used mysql_* and ereg* PHP functions were removed in PHP 7. For very large codebases, refactoring the code to remove them just isn't practical. To that end, we have developed a compatibility library to enable existing websites and PHP scripts to keep running under newer PHP versions.

The code is available on GitHub under the Apache 2.0 Licence. We have included compatibility wrappers for all of the ereg* functions, the most commonly used mysql_* functions, and a couple of other useful functions as well. Using the code is as simple as cloning the repository, and either loading the wrapper using auto_prepend_file in php.ini, or using include()/include_once()/require()/require_once(). The library can safely be loaded multiple times. It can also be safely loaded into PHP 5 setups (e.g. in preparation for the switch to PHP 7). Make sure to read the README notes for instructions and limitations.

We welcome feedback and contributions to make the library more useful for everyone.

Add new comment