xref: /PHP-8.0/tests/lang/021.phpt (revision 782352c5)
1--TEST--
2Switch test 2
3--FILE--
4<?php
5
6for ($i=0; $i<=5; $i++)
7{
8  echo "i=$i\n";
9
10  switch($i) {
11    case 0:
12      echo "In branch 0\n";
13      break;
14    case 1:
15      echo "In branch 1\n";
16      break;
17    case 2:
18      echo "In branch 2\n";
19      break;
20    case 3:
21      echo "In branch 3\n";
22      break 2;
23    case 4:
24      echo "In branch 4\n";
25      break;
26    default:
27      echo "In default\n";
28      break;
29  }
30}
31echo "hi\n";
32?>
33--EXPECT--
34i=0
35In branch 0
36i=1
37In branch 1
38i=2
39In branch 2
40i=3
41In branch 3
42hi
43