PHP
Posted: July 26th, 2009, 5:21 pm
I'm primarily a Pascal/Delphi programmer, and sometimes I'm not able to find the PHP equivalents to programming techniques that I'm used to.
I'm PHPizing the code for convenience (this isn't how you would actually code it in Delphi). In Delphi I could make a statement like:
to avoid having to type
or
to avoid having to type
Is there a PHP equivalent of Delphi's powerful "IN" statement? I can't just type
because it will always return TRUE. I'd prefer not to use a switch case statement in this situation.
I'm PHPizing the code for convenience (this isn't how you would actually code it in Delphi). In Delphi I could make a statement like:
Code: Select all
if ($animal IN ['cat', 'dog', 'mouse'])
Code: Select all
if (($animal == 'cat') OR ($animal == 'dog') OR ($animal == 'mouse'))
Code: Select all
if ($number IN [1,2,5,7..10])
Code: Select all
if (($number <= 2) OR ($number == 5) OR ($number >= 7))
Code: Select all
if ($animal == 'cat' OR 'dog' OR 'mouse')