Forum Moderators: coopster
for($x=0; $x<70; $x++){
echo "THE X = ".$x."<br>";
for($y=0; $y<30; $y++){
echo ">>>>>>>>THE Y = ".$y."<br>";
if($y==10){
stop1(); //- I use the function stop1();
}
}
}
?>
my error is:
Fatal error: Cannot break/continue 1 level in C:\apachefriends\xampp\htdocs\john\URLParser\gui.php on line 33
but if i use
<?
function stop1(){
break;
}
for($x=0; $x<70; $x++){
echo "THE X = ".$x."<br>";
for($y=0; $y<30; $y++){
echo ">>>>>>>>THE Y = ".$y."<br>";
if($y==10){
break; //- direct call of break;
}
}
}
?>
my program goes well....
i need my break command to be in a function...
what is the cause of the fatal error and how to resolve this. thanks for any help...
I don't recon there's a way to put that break in another function.
Maybe you could:
function stop()
{ return "break;";}
while(1){ eval(stop());}
But this is extremely ugly for a programmer! And I don't recommend this usage.
Best regards
Michal Cibor