You are here: pattern containing single quote in IF statement « PHP Programming Language « IT news, forums, messages
pattern containing single quote in IF statement

Posted by thecoolone on 12/26/06 14:22

I am stuck at a wierd problem. I am trying to do comparision between a
"query string" and a "string value". the string consists of some
diacriticals and single quotes.
But when i try to escape the single quotes using backshash (\) it
doesnt
work. and when i try to use it inside a double quote preg_replace()
doesnt
recognise the code.
why is php not comaparing string with single quotes??

here is the code:
if($_GET['query']==new)
{ filter($query);}
elseif($_GET['query']==some'u'all)
{ filter($query);}
elseif($_GET['query']==all'u'ppl)
{ filter($query);}

function filter($query)
{
$pattern = array ('/new/','/some'u'all/','/all'u'ppl/');
$rep = array ("new way","Some of you all ","all of you");
$op = preg_replace($pattern,$rep,$_GET['query']);
echo "<br>new value $op";
}


also i wanted to just clarify is there a way of using multiple OR's in
the
same "if" condition
i.e if(($_GET['query]')==new||newday||newtime||newbeginning||newthing)
{
// fn here;
}

 

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

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