PHP backwards compatibility

Posted in Development on August 18, 2005

Today I was writing some code - which is actually suprisingly rare these days - and I was getting an error about a particular function not existing in PHP5, array_diff_key()

Luckily some body already thought about this and has ported a lot of the older functions into PHP classes that get bundled with Pear (which we use a lot).

So, my issue was quickly fixed by the insertion of these three lines:

if(!function_exists('array_diff_key')) { require_once 'PHP/Compat/Function/array_diff_key.php'; }

Good stuff.

http://pear.php.net/package/PHP_Compat

Comments (0)