quotemeta

(PHP 4, PHP 5, PHP 7, PHP 8)

quotemetaQuote meta characters

Descrição

quotemeta(string$string): string

Returns a version of str with a backslash character (\) before every character that is among these:

. \ + * ? [ ^ ] ( $ )

Parâmetros

string

The input string.

Valor Retornado

Returns the string with meta characters quoted, or false if an empty string is given as string.

Exemplos

Exemplo #1 quotemeta() example

<?php

var_dump
(quotemeta('PHP is a popular scripting language. Fast, flexible, and pragmatic.'));
?>

O exemplo acima produzirá:

string(69) "PHP is a popular scripting language\. Fast, flexible, and pragmatic\."

Notas

Nota: Esta função é compatível com dados binários.

Veja Também

To Top