Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Rygu
· 11y ago · 0 comments
It already implements count() and the corresponding interface so it's possible to write count($collection) as if you're writing $collection->count(). It's a valid question why this type of object needs two methods for checking the same property.
Comments
[–]
hrtyl
11y ago
PHP does not have an interface for empty. count and empty are not equivalent. empty should be called on the underlying array and not the object.