I need to insert backslashes before all instances of double quotes and forward slashes in some text (I'm making a javascript variable out of it).
What isn't working is
$output = preg_replace('("|/)', '\\$1', $input);
This just replaces the quote or slash with '$1'.
I'm sure this is simple - I'm just mighty rusty at my regular expressions.