You are here: preg_match and $ sign in PHP5 « PHP « IT news, forums, messages
preg_match and $ sign in PHP5

Posted by Cabbar Duzayak on 09/06/05 06:20

Hi,

I have a regular expression check as:

preg_match("/$xyz/", $data, $matches);

And, as you know $xyz means "string starts with xyz". But somehow PHP
5 is interpreting this as variable xyz, and gives the notice below.
You can ignore the message, but now it matches everything that has
xyz, i.e. aaxyzbb


PHP Notice: Undefined variable: xyz in /tmp/test.php

Any idea about how I can specify "string starts with xyz" or fix it
such that PHP5 won't recognize this as a variable?

Thanks...

 

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

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