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

-----Original Message-----
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> 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"){

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to