Re:PHP to deprecate MySQL extension
by dave1010uk on Friday July 15, 2011 @02:27PM
(#2768497)
A simple shim wouldn't be too difficult as the mysqli extension is very similar to the mysql one. Off the top of my head, you could try something like this for a quick & dirty way:
$f = array_filter(get_defined_functions()['internal'], create_function('$i', 'return substr(0, 6, $i) === "mysqli_"'));
foreach ($f as $func) {
eval ('
function ' . str_replace("mysqli", "mysql") . ' {
return call_user_func(' . $func . ', function_get_args());
}
');
}
Besides, I'm sure some well-meaning soul will come up with some API-identical library or another to drop in. Yes, it'll still take time; consider it penance for screwing up.
But as noted by a sibling comment, it's deprecated instead of being removed. You have plenty of time to not fix your sites, I guess.