You are here: Re: [PHP] quotemeta() question... « PHP « IT news, forums, messages
Re: [PHP] quotemeta() question...

Posted by Richard Lynch on 02/11/05 19:03

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация