diff --git a/Zend/tests/match/046.phpt b/Zend/tests/match/046.phpt new file mode 100644 index 00000000000..28cf1cf1c3d --- /dev/null +++ b/Zend/tests/match/046.phpt @@ -0,0 +1,41 @@ +--TEST-- +Nested match expressions +--FILE-- + 1, + 'b' => match (1) { + strpos('ab', $b) => 100, + default => 15 + }, + default => 4 +}; + +echo "\n"; + +// Nested in condition expression: +$c = 'c'; +echo match($c) { + 'foo' => 'bar', + match ($c) { default => 'c' } => 300 +}; + +echo "\n"; + +// Nested in one of many condition expressions: +$d = 'd'; +echo match($d) { + 'foo' => 'bar', + match ($d) { default => 'd' }, + match ($d) { default => 'e' } => 500 +}; + + +?> +--EXPECT-- +100 +300 +500 diff --git a/Zend/tests/match/047.phpt b/Zend/tests/match/047.phpt new file mode 100644 index 00000000000..8bbe9fae39e --- /dev/null +++ b/Zend/tests/match/047.phpt @@ -0,0 +1,14 @@ +--TEST-- +Match expression inside subject expression +--FILE-- + 'b' }) { + 'a' => 100, + 'b' => 200, + 'c' => 300 +}; + +?> +--EXPECT-- +200