Function eregi_replace() is deprecated in PHP


PHP

With PHP 5.3 some Functions have been depreciated. Many Drupal developers / users who upgraded their version of PHP may get warnings about functions that have been depreciated.

The word depreciated here basically means that the functions in question were determined to not be as performance efficient hence it is being replaced with a new function.

What this means to developers is that you need to update your code.

A very common warning you will experience is with Function eregi_replace().

Here is how to migrate it with preg_replace() function:

$create_date = explode(' ',eregi_replace('<[^>]*>','', $output));

Becomes

$create_date = explode(' ',preg_replace('/<[^>]*>/','', $output));

If you see any other warnings, with drupal and PHP compatibility, let me know and I'll find you a replacement.

Cheers
Raakesh

Comments