When you have an object that implements countable interface should you use $object->count() or count($object)?
I understand that there is most likely very little difference, but if someone could explain if there is any difference at all, what that would technically be.
count()can be used both on arrays andCountableobjects. If you are using$object->count()you are restricting your function to just objects. Usingcount()you allow arrays too.Apart from that there is no difference. You can see the implementation here: https://github.com/php/php-src/blob/master/ext/standard/array.c#L676