I have written following PHP code:
$input="menu=1&type=0&";
print $input."<hr>".ereg_replace('/&/', ':::', $input);
After running above code, it gives following warning,
Deprecated: Function ereg_replace() is deprecated
How can I resolve this warning.
change the call to ereg_replace to use preg_replace instead
Switch to
preg_replace
Docs 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 forereg_replace
Docs).Here is more information regarding replacing ereg_replace with preg_replace
IIRC they suggest using the
preg_
functions instead (in this case,preg_replace
).http://php.net/ereg_replace says:
Thus, preg_replace is in every way better choice. Note there are some differences in pattern syntax though.
becomes
More example :
is changed to