How can I exit a if
block if a certain condition is met?
I tried using break
but it doesn't work:
if($bla):
$bla = get_bla();
if(empty($bla)) break;
do($bla);
endif;
it says: Fatal error: Cannot break/continue 1 level in...
In PHP 5.3 you can use goto
if($bla):
$bla = get_bla();
if(empty($bla)) goto end;
do($bla);
endif;
end:
But personally I think that's an ugly solution.