FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » terminate a PHP script
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: terminate a PHP script [message #172594 is a reply to message #172591] Tue, 22 February 2011 02:09 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/21/2011 9:04 PM, sheldonlg wrote:
> On 2/21/2011 8:24 PM, The Natural Philosopher wrote:
>> sheldonlg wrote:
>>> On 2/21/2011 1:54 PM, n00m wrote:
>>>>
>>>> > Again, why not if-then-else?
>>>>
>>>> what if it's 10 nested for() stmts?
>>>> And you need to break out of ALL for()'s from the innermost for()?
>>>> Do you like 10 if-then-else conditionals, 1 per each for()?
>>>
>>> && !$exit_all
>>>
>>> in each of the test conditions of the for loop where $exit_all is
>>> initially FALSE outside the outermost loop.
>>>
>>> for ($i1=0, $exit_all=FALSE; $i1 < $i1_end && !$exit_all; $i1++) {
>>> for ($i2=0; $i2 < $i2_end && !$exit_allt; $i2++) {
>>> ..... // and so on
>>> if ($some_condition == TRUE) {
>>> $exit_all = TRUE;
>>> break; // or continue which does one extra check step
>>> }
>>> }
>>> }
>>>
>>>
>>>
>> I didn't understand a word of that. ;-)
>
> I don't understand why? It is clear as a bell.
>
>> AND you used a BREAK. hanging is too good...
>
> A break is not a goto. Far from it. A break says "stop processing _this_
> particular loop/test". Its scope is _clearly defined_. It resumes
> immediately after that loop/test. That is nothing like a goto which is
> an unconditional branch to ANYWHERE in the code. (Also, try writing a
> switch statement without a break.)
>
> But, if you don't like break here, just leave it out. As it turns out,
> in my example the way I wrote it, it is not needed since it is being
> tested in the while condition of the loop. It will exit the loop anyway.
> The only real reason to have the break in the if test is if there were
> some lines of code within that loop after the test.
>

Forget it, Shelly - TNP can't tell the difference between a break (or an
if/then/else, for that matter) and a goto.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extralight browser-webserver communication via cookies (+)
Next Topic: Storing multiple character set types (or a representation of em) in a table column
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 10:46:54 GMT 2024

Total time taken to generate the page: 0.07298 seconds