Friday, March 23, 2012

Ereg To Preg for PHP 5.3.x from PHP 5.2.x -- deprecated error

Some other ereg_replace calls that you might find:
ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)))
ereg_replace('"', ' ', $pieces[$k])
ereg_replace('(' . implode('|', $from) . ')', $to, $string)
ereg_replace('[^0-9]', '', $number)
ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file)
ereg_replace('(' . implode('|', $from) . ')', $to, $string)
ereg_replace("\r","",$which_text)
ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file'])
ereg_replace(",\n$", '', $schema)
ereg_replace("\n#", "\n".'\#', $row)
ereg_replace(', $', '', $schema)
would become
preg_replace('{2037\z}', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)))
str_replace('"', ' ', $pieces[$k])
preg_replace('{(' . implode('|', $from) . ')}', $to, $string)
preg_replace('{\D}', '', $number)
str_replace('-language', '-' . $languages[$j]['directory'], $cached_file)
str_replace("\r","",$which_text)
str_replace('-language', '-' . $language, $cache_blocks[$i]['file'])
preg_replace("{,\n\z}", '', $schema)
preg_replace("{\n#}", "\n".'\#', $row)
preg_replace('{, \z}', '', $schema)
Warning: I haven't tested any of these.          

http://forums.oscommerce.com/topic/341737-function-ereg-replace-is-deprecated/

http://www.devthought.com/2009/06/09/fix-ereg-is-deprecated-errors-in-php-53/

No comments:

Post a Comment