Using missing PHP5 functions in PHP4

April 28th, 2007 · Filed under Archives

With PHP5 a number of new functions were added. Understandably, these functions won’t work if your web server runs PHP4. But there’s a workaround.

PHP_Compat is a package of files with the missing functionality for older PHP version. Each file provides support for one function, and is usually named after the function.

How do you use it?

  1. Download the package.
  2. Find the file you need. Each function is in its own file, e.g. array_walk_recursive.php.
  3. Place this file somewhere in your include_path.
  4. Include it, e.g. <?php require_once ‘array_walk_recursive.php’;?>

The function is now ready to be used.

Note: Don’t let the PEAR website scare you. PHP_Compat can be used without installing PEAR.


Trackback URL for this post:
http://rehuel.com/2007/04/28/using-missing-php5-functions-in-php4/trackback/

blog comments powered by Disqus