xref: /php-src/tests/lang/033.phpt (revision 7aacc705)
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--EXPECT--
41If: 11
42While: 12346789
43For: 0123401234
44Switch: 1
45