note 114594 added to countable.count
| From: | SenseException | Date: | Mon, 10 Mar 2014 11:59:27 +0000 |
| Subject: | note 114594 added to countable.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198850@lists.php.net to get a copy of this message | ||
Even though Countable::count method is called when the object implementing Countable is used in
count() function, the second parameter of count, $mode, has no influence to your class method.
$mode is not passed to Countable::count:
<?php
class Foo implements Countable
{
public function count()
{
var_dump(func_get_args());
return 1;
}
}
count(new Foo(), COUNT_RECURSIVE);
?>
var_dump output:
array(0) {
}
----
Server IP: 212.124.37.9
Probable Submitter: 46.237.218.138
----
Manual Page -- http://php.net/manual/en/countable.count.php
Edit -- https://master.php.net/note/edit/114594
Del: integrated -- https://master.php.net/note/delete/114594/integrated
Del: useless -- https://master.php.net/note/delete/114594/useless
Del: bad code -- https://master.php.net/note/delete/114594/bad+code
Del: spam -- https://master.php.net/note/delete/114594/spam
Del: non-english -- https://master.php.net/note/delete/114594/non-english
Del: in docs -- https://master.php.net/note/delete/114594/in+docs
Del: other reasons-- https://master.php.net/note/delete/114594
Reject -- https://master.php.net/note/reject/114594
Search -- https://master.php.net/manage/user-notes.php