Why count(false) return 1?

count, php

Solution

It's specified behavior:

If var is not an array or an object with implemented Countable interface, 1 will be returned.

According to http://php.net/manual/en/function.count.php

Problem

Do you know why `<?= count(false) ?>` returns `1`?

Original source

Related problems