I need your help guys to replace $ as char.
It seems that $ is ending the line in preg replace and i want to replace “$” char to “;$”
I had made the code:
$search = array(
"/\$/",
$replace = array(
";$",
echo preg_replace($search,$replace,"example $variable to replace");
What i made wrong?
According to RegexBuddy, the following should work:
Your problem has to do with the use of double quotes instead of single quotes in your source string. Try
to avoid variable interpolation in the source string. Or escape the
$in your string: