note 100284 added to control-structures.goto
| From: | tweston at coldsteelstudios dot com | Date: | Wed, 06 Oct 2010 03:12:20 +0000 |
| Subject: | note 100284 added to control-structures.goto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172994@lists.php.net to get a copy of this message | ||
In a challenge of myself for a college class I decided to use the goto to remove all while loops
from my code. It was actually easy, and AS FAST as While loops.
<?PHP
$start = microtime(true);
$i = 0;
StartOfLoop:
$i++;
if($i < 1000000) goto StartOfLoop;
echo microtime(true) - $start.PHP_EOL;
$start = microtime(true);
$i = 0;
while($i < 1000000){
$i++;
}
echo microtime(true) - $start.PHP_EOL;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 76.179.244.157
----
Manual Page -- http://www.php.net/manual/en/control-structures.goto.php
Edit -- https://master.php.net/note/edit/100284
Del: integrated -- https://master.php.net/note/delete/100284/integrated
Del: useless -- https://master.php.net/note/delete/100284/useless
Del: bad code -- https://master.php.net/note/delete/100284/bad+code
Del: spam -- https://master.php.net/note/delete/100284/spam
Del: non-english -- https://master.php.net/note/delete/100284/non-english
Del: in docs -- https://master.php.net/note/delete/100284/in+docs
Del: other reasons-- https://master.php.net/note/delete/100284
Reject -- https://master.php.net/note/reject/100284
Search -- https://master.php.net/manage/user-notes.php