English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP quotemeta() Function Usage and Example

PHP String Function Manual

The quotemeta() function is used to escape the meta character set.

Syntax

string quotemeta ( string $str )

Definition and Usage

 Returns the string escaped with a backslash (\) before the following special characters. These special characters include:

. \ + * ? [ ^ ] ( $ )

Return Value

 Returns the string with the meta characters escaped. If the input string str is empty, it returns FALSE.

Parameter

Serial NumberParameter and Description
1

string

Input String

Online Example

Try the following example, which returns the string escaped with a backslash (\) before special characters

<?php
    //Use quotemeta to return the string escaped with a backslash (\) before special characters
   $input = "www.oldtoolbag.com (simply easy learning)";
   
   echo quotemeta($input);
?>
Test and See‹/›

Output Result

www\.w3codebox\.com (simply easy learning)

PHP String Function Manual