Better not use it, it has to power to make your code unstructured. To illustrate this danger, I made an especially bad example of using gotos.
<?php
/* Fibonaci and goto */
start:
print "Please give a number:";
$n = (int)fgets(STDIN) - 1;
if(!isset($x))
$x = array(1,1);
$last = $i = 0;
$back = 'nextstep';
goto fib;
nextstep:
$t = 0;
$sum = 0;
sum:
print_r($x) ."\n";
if($t > $n){
goto result;
}
$sum += $x[$t];
$t++;
goto sum;
result:
print "The sum is: " . $sum . "\n";
goto start;
jmpspot:
switch($back){
case 'nextstep':
goto nextstep;
break;
default:
goto start;
}
fib:
if($last > $n){
$i = $n;
goto jmpspot;
}
if(!isset($x[$i]))
$x[$i] = $x[$i - 1] + $x[$i - 2];
if($i > $n)
goto jmpspot;
$last = $i;
$i++;
goto fib;
?>
----
Server IP: 69.147.83.197
Probable Submitter: 195.241.100.248
----
Manual Page -- http://www.php.net/manual/en/control-structures.goto.php
Edit -- https://master.php.net/note/edit/98056
Del: integrated -- https://master.php.net/note/delete/98056/integrated
Del: useless -- https://master.php.net/note/delete/98056/useless
Del: bad code -- https://master.php.net/note/delete/98056/bad+code
Del: spam -- https://master.php.net/note/delete/98056/spam
Del: non-english -- https://master.php.net/note/delete/98056/non-english
Del: in docs -- https://master.php.net/note/delete/98056/in+docs
Del: other reasons-- https://master.php.net/note/delete/98056
Reject -- https://master.php.net/note/reject/98056
Search -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.