Re: [PHP] Switch statement Question

2009-01-30 Thread Thodoris
Hi, I have a code snippet here as in the following: //Switch statements between the four options switch($string) { case "": $string= "NOT book.author='All'"; break; default: $string= $string . "AND NOT book.author='All'"; break; } This code does work, but I am wondering if it is possib

Re: [PHP] Switch statement Question

2009-01-29 Thread Jochem Maas
Boyd, Todd M. schreef: >> -Original Message- >> From: Alice Wei [mailto:aj...@alumni.iu.edu] >> Sent: Thursday, January 29, 2009 3:02 PM >> To: php-general@lists.php.net >> Subject: [PHP] Switch statement Question >> >> >> Hi, >> >> I have a code snippet here as in the following: >> >> //

RE: [PHP] Switch statement Question

2009-01-29 Thread Boyd, Todd M.
> -Original Message- > From: Alice Wei [mailto:aj...@alumni.iu.edu] > Sent: Thursday, January 29, 2009 3:02 PM > To: php-general@lists.php.net > Subject: [PHP] Switch statement Question > > > Hi, > > I have a code snippet here as in the following: > > //Switch statements between the f

Re: [PHP] switch statement question

2002-08-13 Thread DL Neil
Alternatively Alexander, take a look at the string functions eg strstr(), stristr(), and strpos() all of which can be used to make a condition within the case() criteria. Regards, =dn > [snip] > Say i have a variable $string_var = "Once upon a time"; > > is there a way to do this: > > Switch($st

RE: [PHP] switch statement question

2002-08-13 Thread Jay Blanchard
[snip] Say i have a variable $string_var = "Once upon a time"; is there a way to do this: Switch($string_var) { case(contains "Once"): doSomething(); break; case(contains "the end.") doOtherThing(); break; case(contains "time") doNothing(); break; default: echo "ERR