PHP: quotemeta - Manual (original) (raw)
(PHP 4, PHP 5, PHP 7, PHP 8)
quotemeta — Quote meta characters
Found A Problem?
kumarkulandai at gmail dot com ¶
16 years ago
<?php
$str = "Hello world. (can you hear me?)";
echo quotemeta($str);
?>
The output of the code above will be:
Hello world\. \(can you hear me\?\)
19 years ago
24 years ago
This function escapes characters that have special meaning in regular expressions. preg_quote() <http://php.net/manual/en/function.preg-quote.php> has similar functionality, but is more powerful since it escapes more characters (including one user-specified character).