By: Strata Ranger Emailed: 1728 times Printed: 2329 times
Although most programmers are aware of this already, if for whatever reason you need to 'break' out of an if() block (which, unlike switch() is not considered a looping structure) just wrap it in an appropriate looping structure, such as a do-while(false):
do if ($foo)
// Do something first...
// Shall we continue with this block, or exit now?
if ($abort_if_block) break;
// Continue doing something...
} while (false);
Be the first one to add a comment
Most Viewed Articles (in PHP )
Most Emailed Articles (in PHP)