xref: /PHP-8.2/Zend/tests/match/012.phpt (revision 9fa1d133)
1--TEST--
2Strict comparison in match expression
3--FILE--
4<?php
5
6function wrong() {
7    throw new Exception();
8}
9
10var_dump(match (0) {
11    null => wrong(),
12    false => wrong(),
13    0.0 => wrong(),
14    [] => wrong(),
15    '' => wrong(),
16    0 => 'int',
17});
18
19function get_value() {
20    return 0;
21}
22
23var_dump(match (get_value()) {
24    null => wrong(),
25    false => wrong(),
26    0.0 => wrong(),
27    [] => wrong(),
28    '' => wrong(),
29    0 => 'int',
30    default => 'default',
31});
32
33?>
34--EXPECT--
35string(3) "int"
36string(3) "int"
37