Re: switch vs elseif

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-01-12 at 16:49 -0500, tedd wrote:
> At 3:32 PM -0500 1/12/09, Robert Cummings wrote:
> >One has to wonder about the readability of the case version though since
> >one may not notice immediately the missing break statement.
> >
> >Cheers,
> >Rob.
> 
> Yes, but that's because of the way you wrote it -- consider this:
> 
> <?php
> switch( $foo )
>     {
>     case 0:
>     // something
>     break;
> 
>     case 2:
>     case 3:
>     // something else
>     // something elser
>     break;
> 
>     default:
>     // something defaulty
>     }
> ?>
> 
> If you group the case's together, then there's no problem 
> understanding what happens in case 2 or 3.

No, that's DIFFERENT from what I wrote. Go back and re-read.

:)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux