xref: /php-src/Zend/tests/empty_with_expr.phpt (revision 7aacc705)
1--TEST--
2empty() with arbitrary expressions
3--FILE--
4<?php
5
6function getEmptyArray() { return []; }
7function getNonEmptyArray() { return [1, 2, 3]; }
8
9var_dump(empty([]));
10var_dump(empty([1, 2, 3]));
11
12var_dump(empty(getEmptyArray()));
13var_dump(empty(getNonEmptyArray()));
14
15var_dump(empty([] + []));
16var_dump(empty([1, 2, 3] + []));
17
18var_dump(empty("string"));
19var_dump(empty(""));
20var_dump(empty(true));
21var_dump(empty(false));
22?>
23--EXPECT--
24bool(true)
25bool(false)
26bool(true)
27bool(false)
28bool(true)
29bool(false)
30bool(false)
31bool(true)
32bool(false)
33bool(true)
34