Can be done already ... sorta.
switch (true) {
case ($str == 'abc'):
echo "it was ABC!\n";
break;
case (preg_match('/^[0-9]+$/i', $str)):
echo "it was a number!\n";
break;
default:
echo "it was no number :-(\n";
break;
}
*shrug*
-james
Ron Korving wrote:
> I have another idea I came up with today: regular expression switches, but
> it would be difficult without adding to the syntax.
>
> switch ($str)
> {
> case "abc":
> echo "it was ABC!\n";
> break;
>
> regcase "/^[0-9]+$/i":
> echo "it was a number!\n";
> break;
>
> default:
> echo "it was no number :-(\n";
> break;
> }
>
> Just an idea ;)
>
> Ron
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php