March 10, 2013
Why count(false) return 1?
Question by Jeremie Ges
Answer by Starx
Because false
is also a value and if the count() does not get array but a valid variable it returns true
which is 1
.
$result = count(null);
// $result == 0
$result = count(false);
// $result == 1