- preg_replace: documentation ( source)
<?php
$text = "";
$word = "mysql_query('Lalala'); 1||1/e\0";
// Slightly contrived example, but let's pretend we're
// case-normalizing a user-provided word, and forgot to
// preg_quote
$text = preg_replace('/'.$word.'/i', $word, $text);