替换PHP中所有已弃用和已删除的函数

I once found a PHP file I could include, that fixes all problems automatically with functions that don't exist any more in a new PHP version by serving replacement functions automatically. Just include the file at the beginning of your old application and it works again in newer PHP versions. But I am not lucky with finding this any more.

It can use function_exists(), for example

if(!function_exists('ereg')){
    function ereg($pattern, $string, &$array) 
    { 
        return preg_match('#'.$pattern.'#', $string, $array); 
    }
}

and version_compare:

if (version_compare(PHP_VERSION, '5.0.0', '<')) {
  ...

Is there a way to easily include a php fix that manages all problems between different PHP versions?

For example, I created an include, that replaces all mysql functions with the corresponding mysqli functions: fix_mysql.inc.php

(I am now mainly searching for a replacement for the old sqlite-functions by the Sqlite3 class)

error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);

This may help you for suppressing else you need to do that manually.