php quotemeta() function


  Translation results:

UK[kwəʊt] US[kwoʊt]

vt.& vi. Quote, quote

vt. Quotation; quote

vi. Quote

n. Quotation; quotation; quotation mark

Third person singular: quotes Plural: quotes Present participle: quoting Past tense: quoted Past participle: quoted

php quotemeta() functionsyntax

Function: Add backslash before predefined characters

Syntax: quotemeta(string)

Parameters:

ParameterDescription
stringMust, required Processed string

Description: This function can be used to escape characters with special meanings, such as ( ), [ ] and * in SQL . This function is binary safe.

php quotemeta() functionexample

<?php
$str1 = "1 + 1 = 2";
$str2 = "1 * 1 = 1";
$str3 = "Welcome to php.cn!";
$str4 = "Are you ok?";
echo quotemeta($str1)."<br>";
echo quotemeta($str2)."<br>";
echo quotemeta($str3)."<br>";
echo quotemeta($str4)."<br>";
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

1 \+ 1 = 2
1 \* 1 = 1
Welcome to php\.cn!
Are you ok\?

Home

Videos

Q&A