AndreaD wrote:
Looking for the most code efficient way to do multiple boolean OR's on one
line
if ($name==andrea) OR ($name==john)
If you put an opening brace after that, you'll get a parse error. You're
also treating andrea and john as constants, which I'm guessing isn't
what you mean. I think
and if u've got several checks for just $name, u could use in_array
(http://php.net/in_array).
if (in_array($name, array('andrea', 'john', 'jane')))
it's case sensitive so if the array has all lower-case letters, u
might wanna use strtolower (http://php.net/strtolower) on $name.
for general case
can do:
if ($name==andrea || $name==john)
On 17 Mar 2005, at 11:59, AndreaD wrote:
if ($name==andrea) OR ($name==john)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
3 matches
Mail list logo