From: Marcus Boerger Date: Sat, 19 Jul 2003 09:50:18 +0000 (+0000) Subject: Move filter functionality to dedicated function X-Git-Tag: BEFORE_ARG_INFO~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59d6d4ab188f03b3bb2cd0bf81ca57d53de5e7fc;p=php Move filter functionality to dedicated function --- diff --git a/ext/spl/examples/filter.inc b/ext/spl/examples/filter.inc index 5aae419caf..be25d6b1aa 100755 --- a/ext/spl/examples/filter.inc +++ b/ext/spl/examples/filter.inc @@ -40,6 +40,10 @@ class filter implements spl_forward unset($this->it); } + protected function accept($curr) { + return ereg($this->regex, $curr); + } + /** * Fetch next element and store it. * @@ -49,7 +53,7 @@ class filter implements spl_forward $this->curr = false; while ($this->it->has_more()) { $curr = $this->it->current(); - if (ereg($this->regex, $curr)) { + if ($this->accept($curr)) { $this->curr = $curr; return; }