Re: [SPAM] - RE: [PHP] SPL Countable count() not being called - Bayesian Filter detected spam
| From: | Justin Francis | Date: | Tue, 30 Aug 2005 16:15:52 +0000 |
| Subject: | Re: [SPAM] - RE: [PHP] SPL Countable count() not being called - Bayesian Filter detected spam | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221604@lists.php.net to get a copy of this message | ||
Jay Blanchard wrote:
[snip] No. By implementing the Countable interface, and implementing the count() method, the global count($c) function is supposed to call $c->count(). This is so the object can be treated like a countable array in the same manner. [/snip] I was asleep earlier....if $c is not an array 1 will be returned. $c is one number (200), not an array. This would be true if the class does not implement the Countable interface. It does, however, and so 1 should not be returned, but instead, whatever number is returned from the count() method of the Collection class. See the SPL documentation at www.php.net/spl for more on how this is supposed to work.- Justin