4 ms·
Actually, here's a more insane version: $x = 0; if(!empty($x)){ echo '"0" is empty'; }
by adambard 15y ago
Actually, here's a more insane version:
$x = 0;
if(!empty($x)){
echo '"0" is empty';
}
- pornel 15y agoempty() is an alias for 'isset($x) && $x', so this example is semantically identical to the previous one (since $x is always set). PHP doesn't have any special concept of "emptyness" to check for.