Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] 'break' command question From: Nick Winfield (pioneer <email protected>)
Date: 07/07/00

On Fri, 7 Jul 2000, Chris Gray wrote:

> Using 'break 2' produces this error ---
> Fatal error: Cannot break/continue 2 levels in
> /home/httpd/html/ggg/break.php on line 5
>
>
> Please forgive my ignorance if there is some arcane Unix explanation for
> this.
> Or have I totally misunderstood the example?

break; will take you out of the top level control structure, and it seems
that if() statements are not classed as control structures under PHP. When
you do a break <number>; you are breaking out of the top level
control structure and trying to execute a second break; when there is no
loop to break out of. What I usually do is if I am iterating until I find
something useful, I put that in a control structure of it's own and allow
the flow of the program to take me down to the next set of if() or while()
clauses. I tried to write a mad regexp script with tons of nested loops
and I ended up getting lost. ;)

I hope that makes sense.

Cheers,

Nicky W..
-[ pioneer <email protected> ]-

"Mibbies naw tha'day, mibbies maw tha'morra,
 but soon... fer the rest o' yer nelly puff!"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>