mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
7aacc705d0
Closes GH-5958
34 lines
557 B
PHP
34 lines
557 B
PHP
--TEST--
|
|
empty() with arbitrary expressions
|
|
--FILE--
|
|
<?php
|
|
|
|
function getEmptyArray() { return []; }
|
|
function getNonEmptyArray() { return [1, 2, 3]; }
|
|
|
|
var_dump(empty([]));
|
|
var_dump(empty([1, 2, 3]));
|
|
|
|
var_dump(empty(getEmptyArray()));
|
|
var_dump(empty(getNonEmptyArray()));
|
|
|
|
var_dump(empty([] + []));
|
|
var_dump(empty([1, 2, 3] + []));
|
|
|
|
var_dump(empty("string"));
|
|
var_dump(empty(""));
|
|
var_dump(empty(true));
|
|
var_dump(empty(false));
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|