On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote:
> Well, it could be this, too:
> 
> switch( $_REQUEST['id'] ) {
>       case "white":
>               echo "Right color.";
>       break;
> 
>       case "black":
>               echo "Right color.";
>       break;
> 
>       default:
>               echo "Wrong color.";
>       break;
> }

Ugh, if you're going to use a big ugly case statement for something so
trivial at least make use of the fall-through feature:

<?php
switch( $_REQUEST['id'] )
{
    case 'white':
    case 'black':
    {
        echo 'Right color.';
        break;
    }

    default:
    {
        echo 'Wrong color.';
    }
}
?>

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to