xref: /PHP-7.2/tests/lang/033.phpt (revision 742d0ad1)
1--TEST--
2Alternative syntaxes test
3--FILE--
4<?php
5$a = 1;
6
7echo "If: ";
8if ($a) echo 1; else echo 0;
9if ($a):
10	echo 1;
11else:
12	echo 0;
13endif;
14
15echo "\nWhile: ";
16while ($a<5) echo $a++;
17while ($a<9):
18	echo ++$a;
19endwhile;
20
21echo "\nFor: ";
22for($a=0;$a<5;$a++) echo $a;
23for($a=0;$a<5;$a++):
24	echo $a;
25endfor;
26
27echo "\nSwitch: ";
28switch ($a):
29	case 0;
30		echo 0;
31		break;
32	case 5:
33		echo 1;
34		break;
35	default;
36		echo 0;
37		break;
38endswitch;
39?>
40
41===DONE===
42--EXPECT--
43If: 11
44While: 12346789
45For: 0123401234
46Switch: 1
47===DONE===
48