Re: How to detect classes with a count_elements handler in userland?
| From: | Craig Duncan | Date: | Sun, 13 Nov 2016 21:10:33 +0000 |
| Subject: | Re: How to detect classes with a count_elements handler in userland? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96878@lists.php.net to get a copy of this message | ||
> How about just making those classes implement the interface instead?
Christoph pointed out that there may be classes in extensions that use
count_elements.
Also it would make userland code simpler:
is_countable($thing)
vs
is_array($thing) || $thing implements \Countable