RE: Re[2]: [PHP] if statement
| From: | Martin Towell | Date: | Tue, 09 Jul 2002 04:17:43 +0000 |
| Subject: | RE: Re[2]: [PHP] if statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-106225@lists.php.net to get a copy of this message | ||
I was looking for a similar functionality to Pascal's "in" statement and
when I looked at someone's code one day and saw this in_array() thing and
thought, "Aha! That's how you do it!" and ever since I've made good use of
it.
-----Original Message-----
From: rdkurth@starband.net [mailto:rdkurth@starband.net]
Sent: Tuesday, July 09, 2002 2:21 PM
To: php-general
Subject: Re[2]: [PHP] if statement
Hello Martin,
Thanks the array worked just perfect. Where do you find stuff like
this I looked all over the manual and could not find anything that
told me how to do this.
Monday, July 08, 2002, 9:01:44 PM, you wrote:
MT> You can do this:
MT> if ($type == "test1" || $type == "test2" || $type == "test3") {
MT> or, what I prefer in this case
MT> if (in_array($type, array("test1", "test2", "test3"))) {
MT> Martin
MT> -----Original Message-----
MT> From: rdkurth@starband.net [mailto:rdkurth@starband.net]
MT> Sent: Tuesday, July 09, 2002 2:11 PM
MT> To: php-general
MT> Subject: [PHP] if statement
MT> Is it possible to do something like this all on one line.
MT> What I need is if any one of these are true then run the script
MT> if($type=="test1")or($type=="test2")or($type=="test3"){