Function ereg_replace() is deprecated - How to clear this bug? [duplicate] Function ereg_replace() is deprecated - How to clear this bug? [duplicate] php php

Function ereg_replace() is deprecated - How to clear this bug? [duplicate]


Switch to preg_replaceDocs and update the expression to use preg syntax (PCRE) instead of ereg syntax (POSIX) where there are differencesDocs (just as it says to do in the manual for ereg_replaceDocs).


print $input."<hr>".ereg_replace('/&/', ':::', $input);

becomes

print $input."<hr>".preg_replace('/&/', ':::', $input);

More example :

$mytext = ereg_replace('[^A-Za-z0-9_]', '', $mytext );

is changed to

$mytext = preg_replace('/[^A-Za-z0-9_]/', '', $mytext );


change the call to ereg_replace to use preg_replace instead