diff options
author | Andrea Faulds <ajf@ajf.me> | 2014-09-23 16:28:02 +0100 |
---|---|---|
committer | Andrea Faulds <ajf@ajf.me> | 2014-09-23 16:28:02 +0100 |
commit | ec39802e4e7dac14b629f41017d04573a6a5fdc4 (patch) | |
tree | 7f264026b03b82142b6d89dbb4f037c0c11a2e52 | |
parent | 157da54e8236f939ed79fa9f91a2c9f4dd08fc68 (diff) | |
download | php-git-ec39802e4e7dac14b629f41017d04573a6a5fdc4.tar.gz |
Extended coalesce operator test case for ordering/short-circuiting
-rw-r--r-- | tests/lang/operators/coalesce.phpt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt index 327a11a432..2ee54c5276 100644 --- a/tests/lang/operators/coalesce.phpt +++ b/tests/lang/operators/coalesce.phpt @@ -42,6 +42,14 @@ var_dump($arr["bing"][0] ?? 3); var_dump($arr["bing"][1] ?? 3); echo PHP_EOL; var_dump(foobar()[0] ?? false); +echo PHP_EOL; +function f($x) +{ + printf("%s(%d)\n", __FUNCTION__, $x); + return $x; +} + +$a = f(null) ?? f(1) ?? f(2); ?> --EXPECTF-- int(3) @@ -65,4 +73,7 @@ string(4) "bang" int(3) called -string(1) "a"
\ No newline at end of file +string(1) "a" + +f(0) +f(1)
\ No newline at end of file |