![]() |
Breaking out of a... not a loop.
Is there any way, say if you were using curly braces to organize your code into blocks, ie;
PHP Code:
This is for purely aesthetic reasons at this point, I'm trying to create a block of if statements that will look more like a switch statement than a spaghetti mess of if's and else if's. PHP Code:
|
Within a function you can
return at any point. PHP Code:
elseif to string your checks together? In other words, why is this (bearing in mind, it's not syntactically correct PHP):PHP Code:
PHP Code:
break then you'll need to use some form of looping structure (to loop once) out of which you can break (note: not pretty!) :PHP Code:
|
Yeah, in retrospect I jumped the gun asking that question. I know break wasn't going to work, I had already tested that one. I had a huge block of else if's and I was just looking at different ways of writing it so that I could still read it later on. Turns out using curly braces to block out each specific group and using comments to label them made it easily readable on its own.
I just think too much, and usually not about useful stuff. Thanks anyways. :) -m |
| All times are GMT. The time now is 02:00 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0