The quotemeta() function adds backslashes in front of some predefined characters in a string.
This function can be used to escape characters with special meanings, such as ( ), [ ], and * in SQL.
This function is binary-safe.
The predefined characters are:
- period (.)
- backslash (\)
- plus sign (+)
- asterisk (*)
- question mark (?)
- brackets ([])
- caret (^)c
- dollar sign ($)
- parenthesis (())
Example
<?php $str = "PHP Codez. (Welcome)"; echo quotemeta($str); ?>
It outputs PHP Codez\. \(Welcome\)
2 thoughts on “quote_meta”