summaryrefslogtreecommitdiff
path: root/Zend/tests/match/001.phpt
blob: 9d338c1b423a25c69c8dff535f973c0e1b27f80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
Basic match expression functionality test
--FILE--
<?php

function wordify($x) {
    return match ($x) {
        0 => 'Zero',
        1 => 'One',
        2 => 'Two',
        3 => 'Three',
        4 => 'Four',
        5 => 'Five',
        6 => 'Six',
        7 => 'Seven',
        8 => 'Eight',
        9 => 'Nine',
    };
}

for ($i = 0; $i <= 9; $i++) {
    print wordify($i) . "\n";
}

?>
--EXPECT--
Zero
One
Two
Three
Four
Five
Six
Seven
Eight
Nine