xref: /PHP-7.4/Zend/tests/empty_with_expr.phpt (revision ec061a93)
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--EXPECT--
23bool(true)
24bool(false)
25bool(true)
26bool(false)
27bool(true)
28bool(false)
29bool(false)
30bool(true)
31bool(false)
32bool(true)
33