note 126722 added to control-structures.goto
| From: | Donotdothis at main dot php dot net | Date: | Tue, 28 Dec 2021 21:15:55 +0000 |
| Subject: | note 126722 added to control-structures.goto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217431@lists.php.net to get a copy of this message | ||
// fibonacci sequence
$loops = 21;
$i = -1;
$a = 0;
setup:
$$a = $a;
echo $$a. "\n";
$a++; $i++;
if ($i == 0) goto setup;
start:
$input1 = $i-1;
$input2 = $i;
goto calculate;
inside:
$a = $i+1;
echo $result. "\n";
$$a = $result;
$i++;
if ($i < $loops) goto start;
return;
calculate:
$result = $$input1 + $$input2;
goto inside;
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 2a02:a465:b370:1:827:1c39:dbd7:65c2)
----
Manual Page -- https://php.net/manual/en/control-structures.goto.php
Edit -- https://main.php.net/note/edit/126722
Del: integrated -- https://main.php.net/note/delete/126722/integrated
Del: useless -- https://main.php.net/note/delete/126722/useless
Del: bad code -- https://main.php.net/note/delete/126722/bad+code
Del: spam -- https://main.php.net/note/delete/126722/spam
Del: non-english -- https://main.php.net/note/delete/126722/non-english
Del: in docs -- https://main.php.net/note/delete/126722/in+docs
Del: other reasons-- https://main.php.net/note/delete/126722
Reject -- https://main.php.net/note/reject/126722
Search -- https://main.php.net/manage/user-notes.php