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 #172534 is a reply to message #172530] Mon, 21 February 2011 17:06 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
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
[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:22:53 GMT 2024

Total time taken to generate the page: 0.04012 seconds