PHP preg_quote April 23, 2018 Pramod T P Leave a comment preg_quote() takes str and puts a backslash in front of every character that is part of the regular expression syntax. Example <?php $keywords = 'PHP Code$'; $keywords = preg_quote($keywords, '/'); echo $keywords; ?> Outputs PHP Code\$