Thank God for PHP_Compat


So I was hacking on a little PHP project to parse JULIE Ticket e-mails. I mentioned it before, and while I’m still having fun with simple string parsing functions, being able to use PHP5’s file_put_contents() function in PHP4 would be nice.

Thank God for PHP_Compat. Here’s how easy it is to use file_put_contents() in PHP4:

  1. In a console window: pear install php_compat
  2. In PHP:

    require_once(PHP/Compat/Function/file_put_contents.php');<br /> file_put_contents($filename, $contents);

And most importantly, it worked perfectly out of the box.