Reply to Re: [PHP] preg_match and $ sign in PHP5

Your name:

Reply:


Posted by Robin Vickery on 09/06/05 10:35

On 9/6/05, Cabbar Duzayak <cabbar@gmail.com> wrote:
> Hi,
>
> I have a regular expression check as:
>
> preg_match("/$xyz/", $data, $matches);
>
> And, as you know $xyz means "string starts with xyz".

No it doesn't - "string starts with xyz" would be "/^xyz/" which
coincidentally avoids your problem of xyz being interpreted as a
variable name.

More generally, if you don't want $xyz interpreted as a variable, then
use single quotes - or if you must use double quotes, then escape the
$ with a backslash.

-robin

[Back to original 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

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