Re: If-statement

From: Date: Wed, 29 Aug 2001 12:47:44 +0000
Subject: Re: If-statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65008@lists.php.net to get a copy of this message
"Niklas lampén" <niklas.lampen@publico.fi> wrote in message news:NPEFKEPHNLKEPEOLHPKNOELCCDAA.niklas.lampen@publico.fi... > Is it possible to write this shorter: > > if ($Var != "No1" && $Var != "No2" && $Var != > "No3") { > code > }; $badValues = array("No1", "No2", "No3"); if (!in_array($Var, $badValues)) { code; } Also note that your trailing semicolon is unnecessary.

« previous php.general (#65008) next »