mirror of
https://github.com/php/php-src.git
synced 2024-12-19 15:00:15 +08:00
33 lines
554 B
Plaintext
33 lines
554 B
Plaintext
|
--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)
|