Skip to content

Commit e5beb6a

Browse files
committed
test for ternary expressions
1 parent 33cc637 commit e5beb6a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎Zend/tests/array_variable_shorthand/basic.phpt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ echo json_encode([$condition ? 'bar' :$baz]), "\n";
1313
echo json_encode([$condition ?:$baz]), "\n";
1414
echo json_encode([$condition ? 'bar' :$baz, :$x]), "\n";
1515

16+
$a = true;
17+
$b = 'yes';
18+
$c = 'no';
19+
$multiline = [ $a ? $b
20+
: $c
21+
];
22+
echo json_encode($multiline), "\n";
23+
$a = false;
24+
$multiline = [ $a ? $b
25+
: $c
26+
];
27+
echo json_encode($multiline), "\n";
28+
1629
$X = 40;
1730
echo json_encode([:$x, :$X]), "\n";
1831
echo json_encode([$x = $y]), "\n";
@@ -43,6 +56,8 @@ echo json_encode(array('outer' => [:$x])), "\n";
4356
[7]
4457
[7]
4558
{"0":7,"x":10}
59+
["yes"]
60+
["no"]
4661
{"x":10,"X":40}
4762
[20]
4863
int(11)

0 commit comments

Comments
 (0)