exit would stop all code after it from working.
i think in order for break to work, it must but within {}'s (curley brackets).
i have just tried this, and found that you can use {} to mark any code (without a control structure) and use break to exit it if required. for example:
Code:
{
echo "start, "
$retval = true;
if ($retval)
break;
echo "i never get printed, ";
}
echo "end";
this will produce "start, end" as it will always break out of the {}'s at the iff statement.
you can also have the {}'s nested several times, and use break 2; (or another number) to break out of the specified number of {}'s.
I probably haven't explained it very well, but you should be able to play around and get it working.
Enter your message below
Sign in or Join us (it's free).