RE: [PHP] Re: unless something...

From: Date: Thu, 12 Sep 2002 17:23:07 +0000
Subject: RE: [PHP] Re: unless something...
Groups: php.general 
Request: Send a blank email to php-general+get-116188@lists.php.net to get a copy of this message
True, but isn't unless just a negated while? q.e.d. while ($c==$a OR $c==$b) { blabla exit 0 } -----Original Message----- From: Johnson, Kirk [mailto:kjohnson@zootweb.com] Sent: Thursday, September 12, 2002 10:28 AM To: php-general@lists.php.net Subject: RE: [PHP] Re: unless something... There is no 'unless' in PHP, so you just have to grind it out. If you are searching for known strings, rather than string *patterns*, use the strstr() function here: http://www.php.net/manual/en/function.strstr.php. So, something like: if(!strstr($c,$a) && !strstr($c,$b)) { bla; exit; } Completely untested ;) If you are looking for patterns, see preg_match(), linked to from the link above. Kirk > "Magnus Solvang" <magnus@solvang.net> wrote in message > news:20020912174709.A17211@first.knowledge.no... > > I'm used to the unless-statement in perl... How do I do this: > > > > if string A or B are NOT in string C, then do something and quit. > > > > In perl, I would do this: > > > > unless ($c =~ /$a|$b/) { > > blabla > > exit 0 > > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#116188) next »