Re: quotemeta() question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve Kaufman wrote:
> Why does
>           quotemeta("pat:1$WRW")
> return
>           pat:1
> instead of
>           pat:1\$WRW
>
> What am I misunderstanding about quotemeta function?

You usually would use quotemeta on data coming from the database, or the
user, or externally, or, errr, basically things you haven't typed in to
PHP, that you need to pass into Regular Expressions.

In those cases, you've already got the $ (and other characters)
successfully embedded in the string, but you want to escape them for
whatever reason.

A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo "<PRE>", quotemeta($string), "</PRE>";


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux