In PHP 5.3 note that
ereg
,
eregi
, and
ereg_replace
are deprecated.
This means that any script using those directives will fail to run at all when the server is upgraded to use PHP 5.3.
I have been putting off upgrading some scripts for many months, but this week they will all be amended.
So far, today, I've tackled a basic CMS and it took only an hour to find and replace all of the affected code and then check the edits very carefully.
The site was updated and back online in less than ten minutes once the decision to make the new scripts live was taken.
The changes are very simple. Change the pattern part of the expression from 'pattern' to '/pattern/' by inserting the slash delimiters as shown.
ereg
becomes
preg_match
ereg_replace
becomes
preg_replace
eregi
becomes
preg_match
but with an extra i added after the final slash in the pattern, like '/pattern/
i'.
Here the "pattern" represents any regular expression.
There's nothing difficult or complicated about the changes.
There are literally thousands of sites with more detailed code examples.
In summary, there's no reason to hold off making this update to all of your code. It's a trivial job to fix the lot. However, be warned that you'll also probably be tempted to make other minor changes and fixes at the same time.