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
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:
>>
>> //
> -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
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
[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
5 matches
Mail list logo