> > <?php
> > $say = switch (date("w")) {
> > case 0 => "weekend!";
> > case 1, 2, 3, 4, 5 => "weekday :(";
> > case 6 => "weekend!";
> > };
> > echo "Today is {$say}";
If you had a really long expression, it may be easier to read if the
assignment was moved to the end, perhaps like this:
switch (date("w")) {
case 0 => "weekend!";
case 1, 2, 3, 4, 5 => "weekday :(";
case 6 => "weekend!";
// lots more cases ...
} => $say;
echo "Today is {$say}";
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php