Re: switch case - to require the break statements seems strange to me

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

 



On Fri, 2008-09-12 at 10:58 +0100, Luke wrote:
> I wonder if this is a shared trait between C and PHP (since I understand PHP
> is written in C) that the break; and the default: are placed for good
> practice in all switch statements since they prevent memory leaks?

Prevent memory leaks? WHAT?

Even if that were an issue, implementation of switch in PHP does not
look like a switch.

Breaks are used to prevent fall through to the next case condition.
Default is used as a catch-all... if you need a catch-all. It is
perfectly valid for a case statement to fall through to the next case
statement if the code can be shared.

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