For example if $x=""; what will empty($x) return? or is_null($x)? Or the even more surprising one: $x = "0" will return TRUE on empty() even though it is considered a string.
For example if $x=""; what will empty($x) return? or is_null($x)? Or the even more surprising one: $x = "0" will return TRUE on empty() even though it is considered a string.
1 | Mark J
September 22nd, 2004 at 7:59 pm
Very tricky stuff… don't even get me started on the triple equals… if ($x === 1)
2 | michel
September 23rd, 2004 at 6:28 pm
This is why empty() blows and why it should be avoided.
(And why checking the data type is most usually a good idea if you need accurate results!)