phppreg-replaceereg-replace

PHP: deprecated EREG_REPLACE to PREG_REPLACE


Possible Duplicate:
How can I convert ereg expressions to preg in PHP?

What is the equivalent of this EREG_REPLACE function in PREG_REPLACE?

$html = ereg_replace("[^A-Za-z._0-9@ ]"," ",$html);

Solution

  • $html = preg_replace("/[^A-Za-z._0-9@ ]/"," ",$html);
    

    The biggest difference is the delimiters on the ends, though there are others. Read here.