what is the syntax of the QUOTEMETA() function in php?
quotemeta(string)
Parameter | Description |
---|---|
string | Required. Specifies the string to check |
examples of the QUOTEMETA() function
Examples 1. In this example, we add backslashes in front of the predefined characters.
<?php
$str = "Hello world. (can you hear me?)";
echo quotemeta($str);
?>
Examples 2. In this example, add backslashes in front of many predefined characters.
<?php
$str1 = "1 + 1 = 2";
$str2 = "1 * 1 = 1";
$str3 = "Could you borrow me 5$?";
$str4 = "Are you not entertained? (I am..)";
$str5 = "The caret [ ^ ] Looks like a hat!";
echo quotemeta($str1)."<br>";
echo quotemeta($str2)."<br>";
echo quotemeta($str3)."<br>";
echo quotemeta($str4)."<br>";
echo quotemeta($str5)."<br>";
?>