On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote: > Luke schreef: >> >> 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? > > default is not required, never heard it was good practice to always put it > in. I can't say I've ever heard it recommended as good practice from the standpoint of performance in any specific language I've ever worked with, but I have heard people suggest that you always include an explicit default case in any kind of branching logic. It does seem useless to say default: // do nothing break; in a switch block, but I imagine the reasoning behind it is so that anyone who reads your code can see that you actually thought about what should/would happen if none of the other conditions were true rather than ignoring those conditions. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php