xref: /PHP-8.0/Zend/tests/match/001.phpt (revision 9fa1d133)
1--TEST--
2Basic match expression functionality test
3--FILE--
4<?php
5
6function wordify($x) {
7    return match ($x) {
8        0 => 'Zero',
9        1 => 'One',
10        2 => 'Two',
11        3 => 'Three',
12        4 => 'Four',
13        5 => 'Five',
14        6 => 'Six',
15        7 => 'Seven',
16        8 => 'Eight',
17        9 => 'Nine',
18    };
19}
20
21for ($i = 0; $i <= 9; $i++) {
22    print wordify($i) . "\n";
23}
24
25?>
26--EXPECT--
27Zero
28One
29Two
30Three
31Four
32Five
33Six
34Seven
35Eight
36Nine
37