$s =~ s!\Q$search!$replacement!g;
\Q will quote a string until \E (if \E is ommitted will quote the whole string). You need to quote the string because s/// uses regexp;
You can view more Perl written in PHP here.
$s =~ s!\Q$search!$replacement!g;
\Q will quote a string until \E (if \E is ommitted will quote the whole string). You need to quote the string because s/// uses regexp;
You can view more Perl written in PHP here.