The quotemeta() function is used to quote meta-characters and add backslashes in front of the predefined characters. The following are some of the pre-defined characters: period (.), backslash (\), plus sign (+), asterisk (*), question mark (?), etc.
Syntax
quotemeta(str)
Parameters
str − The input string to check
Return
The quotemeta() function returns the string with meta-characters quoted. It returns FALSE if the input string is empty.
Example
The following is an example −
<?php $str = "3 * 9 = 27"; echo quotemeta($str); ?>
Output
3 \* 9 = 27
Example
The following is an example −
<?php $str = "The ticket cost for cricket match is 200$!"; echo quotemeta($str)."<br>"; ?>
Output
The ticket cost for cricket match is 200\$!