Re: [PHP] Control Structure problem
try if ( $var == TEST ONE || $var == TEST TWO || $var == TEST THREE) { do something; } luke - Original Message - From: Dan J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 9:53 AM Subject: [PHP] Control Structure problem This doesnt work as expected. if ( $var === TEST ONE || TEST TWO || TEST THREE) { do something; } It returns true on all strings. Ive tried using the or operator and the == but these fail as well. Any Ideas? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control Structure problem
I think speaking for everyone its great to be able to help, we all started somwhere :) i remember getting stuck on the same problem in visual basic ages ago Luke - Original Message - From: Dan J. Rychlik [EMAIL PROTECTED] To: Luke Skywalker [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:12 AM Subject: Re: [PHP] Control Structure problem Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. Thank you again. -Dan - Original Message - From: Luke Skywalker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 7:01 PM Subject: Re: [PHP] Control Structure problem try if ( $var == TEST ONE || $var == TEST TWO || $var == TEST THREE) { do something; } luke - Original Message - From: Dan J. Rychlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 9:53 AM Subject: [PHP] Control Structure problem This doesnt work as expected. if ( $var === TEST ONE || TEST TWO || TEST THREE) { do something; } It returns true on all strings. Ive tried using the or operator and the == but these fail as well. Any Ideas? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control Structure problem
yeah, it does make more sense to do it that way for some things, but when you get ands, and ors, it gets complicated eg. if ($a == foo $b == bar || something){ //do something } does that mean $a can either = foo or something or $b = bar or something? and thats just a simple example :) but i know it would be really nice in simple logical expressions Luke - Original Message - From: Chris W. Parker [EMAIL PROTECTED] To: Dan J. Rychlik [EMAIL PROTECTED]; Luke Skywalker [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:18 AM Subject: RE: [PHP] Control Structure problem Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said: Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. lovingjab If by I truly know the level of expertise on this mailing list you meant I truly don't know the basics of PHP syntax, then yeah, you'd be right. ;) !! /lovingjab :) Chris. p.s. Or maybe it's me that's doesn't know the basics... ?? p.p.s. I totally think that the syntax you presented is logical and should be available. It makes much more sense to me to do it the way you did, but alas... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control Structure problem
yeah, i really like using cases they work well and especially if you want to do something different for different values, i forgot about that, its a good way to do it, does php have case else? cuz that is a really handy thing in VB that people often forget... Luke - Original Message - From: Curt Zirzow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:49 AM Subject: Re: [PHP] Control Structure problem * Thus wrote Chris W. Parker ([EMAIL PROTECTED]): Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said: Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. p.p.s. I totally think that the syntax you presented is logical and should be available. It makes much more sense to me to do it the way you did, but alas... Well technically you can do it like: switch ($var) { case 'TEST-1': case 'TEST-2': case 'TEST-2': do something } Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control Structure problem
Yeah, thats exactly what im thinking, and speaking of it, im going to start using it a lot more :) thanks Luke - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Luke Skywalker' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:51 AM Subject: RE: [PHP] Control Structure problem are you thinking of default: ? -Original Message- From: Luke Skywalker [mailto:[EMAIL PROTECTED] Sent: Wednesday, 17 September 2003 10:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Control Structure problem yeah, i really like using cases they work well and especially if you want to do something different for different values, i forgot about that, its a good way to do it, does php have case else? cuz that is a really handy thing in VB that people often forget... Luke - Original Message - From: Curt Zirzow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 10:49 AM Subject: Re: [PHP] Control Structure problem * Thus wrote Chris W. Parker ([EMAIL PROTECTED]): Dan J. Rychlik mailto:[EMAIL PROTECTED] on Tuesday, September 16, 2003 5:12 PM said: Thank you guys. I truly know the level of expertise on this mailing list, and I know that it proves invaluable. p.p.s. I totally think that the syntax you presented is logical and should be available. It makes much more sense to me to do it the way you did, but alas... Well technically you can do it like: switch ($var) { case 'TEST-1': case 'TEST-2': case 'TEST-2': do something } Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php