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($string_var)
> {
>   case(contains "Once"):
>    doSomething();
>    break;
>   case(contains "the end.")
>    doOtherThing();
>    break;
>   case(contains "time")
>    doNothing();
>    break;
>   default:
>     echo "ERROR"
> }
> [/snip]
>
> http://www.php.net/manual/en/control-structures.switch.php
>
> Yes Virginia, there is a PHP function :^]. You can explode your
$string_var
> into an array, loop through the array and test each word for a match.
>
> HTH!
>
> Jay
>
>
>
> --
> 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

Reply via email to