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 #172593 is a reply to message #172588] Tue, 22 February 2011 02:08 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 2/21/2011 8:46 PM, The Natural Philosopher wrote:
> sheldonlg wrote:
>> On 2/21/2011 7:28 PM, The Natural Philosopher wrote:
>>> sheldonlg wrote:
>>>> On 2/21/2011 12:06 PM, Denis McMahon wrote:
>>>> > On 21/02/11 16:51, n00m wrote:
>>>> >>> No, you should not use goto! It causes more problems than it solves.
>>>> >>
>>>> >> Why on the earth???
>>>> >> "goto" can produce 10000 empty lines in no time. Like this:
>>>> >
>>>> > Because there is no structure to a program that uses goto. When it
>>>> > fails
>>>> > to work properly (and it will) it can become impossible to see how it
>>>> > arrived at the point that it fails at.
>>>> >
>>>> >> $cnt = 0;
>>>> >>
>>>> >> mm:
>>>> >> ++$cnt;
>>>> >> echo '<BR>';
>>>> >> if ($cnt< 10000) goto mm;
>>>> >
>>>> > Your goto method uses 5 lines. A while loop uses 2:
>>>> >
>>>> > $i = 10000;
>>>> > while ($i--) echo "<br>\n";
>>>> >
>>>> > and a for loop only 1:
>>>> >
>>>> > for ($cnt = 10000; $cnt--;) echo "<br>\n";
>>>> >
>>>> > or:
>>>> >
>>>> > for ($cnt = 0; $cnt< 10000; $cnt++) echo "<br>\n";
>>>> >
>>>> > Rgds
>>>> >
>>>> > Denis McMahon
>>>>
>>>> I fully agree about gotos. There is NO need for them. What is wrong
>>>> with this pseudocode?
>>>>
>>>> ===========
>>>> if (passes test for failure condition) {
>>>> ... all the rest of the code for success that is already there
>>>> --- except the footer
>>>> }
>>>>
>>>> footer stuff.
>>>> ==========
>>>>
>>>> All it does is add two lines (the if test and a closing brace) and one
>>>> level of indentation, and it does what the OP wants.
>>>>
>>>> Since seeing the if-then-else first appear in Fortran circa 1980, I
>>>> have never used a single goto in any language in which I have coded.
>>>>
>>> Well that's cos you never wrote Assembler :-)
>>>
>>
>> Correct! That was before even my time. :-) By the time I got into it
>> with Fortran IV, the compiled code looked an awful lot like Assembly
>> code. Machines should be labor saving devices. That was what the
>> compiler was for. Besides, it is much easier to debug and maintain a
>> language that is readable, and not like spaghetti code (gotos and jumps).
>>
> The art of writing assembler, is to MAKE it readable DESPITE the language.
>
> And, if you wanted to write hardware code in the 80's for them new
> fangled Micro Processors, that mate, was all there was!

I understand that. I also understand that this is three decades later.
Do you still wear leisure suits and sport an Afro or go to discos?

--
Shelly
[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: Tue Nov 26 23:29:01 GMT 2024

Total time taken to generate the page: 0.25388 seconds