Definition
The quotemeta() function adds backslashes in front of some predefined characters in a string.
Predefined characters:
- period (
.) - backslash (
\) - plus sign (
+) - asterisk (
*) - question mark (
?) - brackets (
[]) - caret (
^) - dollar sign (
$) - parenthesis (
())
Syntax
quotemeta(string)
Parameters
| Parameter | Description |
|---|---|
string |
Required. Specifies the string to check. |
Example
<?php
$hello = "Hello world? (Greetings!)";
echo quotemeta($hello);