replace_ereg

Posix ereg which will not be included in PHP6 core, you can optionally include it in the install, otherwise you’d use pcre preg_match. In WordPress, ereg is still used in the squirrelmail POP3 class (trunk), afaik wordpress as it is distributed up till now will fail if it tries to load the POP3-class with a standard PHP 6 install.

I don’t so much have a problem with that, there is not even a release date set for PHP6.

I was pondering more in general on backward compatibility and legacy function support, ereg serves as a nice example.

Does it make sense to make a plugin with general php patches ? A central plugin would make it easier for some coders (me of course) to check what functions are dropped, and update code without code breaks caused by updates of php or wordpress core.

So I don’t have to reinvent the wheel. Something simple like :

  1. if(!function_exist('ereg_replace') {
  2.     function ereg_replace($pattern, $replace, $source) {
  3.        return preg_replace("/". $pattern."/", $replace, $source);  
  4.     }
  5. }

Anyways, I’ll have to read about it some more I think.

Posted in php.

Leave a Reply

Your email address will not be published. Required fields are marked *