RSS

PHP backwards compatibility

Thu, Aug 18, 2005

PHP

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

This post was written by:

Bealers - who has written 352 posts on Darren Beale.


Contact the author

Leave a Reply