i have looked into the past topics and read some questions relative of this argument. What i need is just a confirm, i have a lot of pages that uses functions that are deprecated now. I wanto to change those functions but i need to know if this type of changin is correct.
(Example)
//Ereg
$pattern = "[[:space:]]";
$replace = "_";
$string = "Hello to Everyone";
echo ereg_replace($pattern, $replace, $string);
To convert into preg_replace can i do this?
//Preg
$pattern = "[[:space:]]";
$pattern = '/'.addcslashes($pattern, '/').'/';
$replace = "_";
$string = "Hello to Everyone";
echo preg_replace($pattern, $replace, $string);
I Know that in this example i don't need to use the addcslashes function but sometimes i need to use a pattern with slashes and so i want to understand how to use it.
So if is correct this '/'.addcslashes($pattern, '/').'/'; or if i Have to change something.
Thanks a lot!!!