// Infinite Loop Using goto
$count = 0;
loop_start: // infinite loop
echo "Loop index: $count\n";
if ($count === 3) {
echo "Breaking out of loop...\n";
goto loop_end;
}
$count++;
goto loop_start; // infinite loop
loop_end:
echo "Loop ended.\n";
/*
run:
Loop index: 0
Loop index: 1
Loop index: 2
Loop index: 3
Breaking out of loop...
Loop ended.
*/