44 parent::__construct($it);
55 $this->
key = parent::key();
56 $this->
current = parent::current();
65 if($this->flags & self::REPLACE) {
66 return (
bool) call_user_func($this->callback, &$this->
current);
68 return (
bool) call_user_func($this->callback, $this->
current);
71 if($this->flags & self::REPLACE) {
72 return (
bool) call_user_func($this->callback, &$this->
key);
74 return (
bool) call_user_func($this->callback, $this->
key);
77 if($this->flags & self::REPLACE) {
78 return (
bool) call_user_func($this->callback, &$this->
key, &$this->
current);
80 return (
bool) call_user_func($this->callback, $this->
key, $this->
current);
const USE_FALSE
mode: accept no elements, no callback
const USE_KEY
mode: pass key to callback
__construct(Iterator $it, $callback, $mode=self::USE_VALUE, $flags=0)
Construct a CallbackFilterIterator.
const USE_BOTH
mode: pass value and key to callback
const USE_VALUE
mode: pass value to callback
$mode
mode any of USE_VALUE, USE_KEY, USE_BOTH
A non abstract FiletrIterator that uses a callback foreach element.
Abstract filter for iterators.
accept()
Call the filter callback.
const REPLACE
flag: pass key/value by reference
const USE_TRUE
mode: accept all elements, no callback