note 110247 added to function.array-filter
| From: | jtreminio at gmail dot com | Date: | Thu, 04 Oct 2012 19:11:25 +0000 |
| Subject: | note 110247 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191133@lists.php.net to get a copy of this message | ||
You can use array_filter from within a class to access a protected method from that same class:
<?php
class Bar {
public function foo()
{
$array1 = array("a"=>1, "b"=>2, "c"=>3,
"d"=>4, "e"=>5);
print_r(array_filter($array1, array($this, 'naz')));
}
protected function baz($var)
{
return($var & 1);
}
}
$bar = new Bar();
$bar->foo();
----
Server IP: 192.41.42.26
Probable Submitter: 96.226.27.121
----
Manual Page -- http://www.php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/110247
Del: integrated -- https://master.php.net/note/delete/110247/integrated
Del: useless -- https://master.php.net/note/delete/110247/useless
Del: bad code -- https://master.php.net/note/delete/110247/bad+code
Del: spam -- https://master.php.net/note/delete/110247/spam
Del: non-english -- https://master.php.net/note/delete/110247/non-english
Del: in docs -- https://master.php.net/note/delete/110247/in+docs
Del: other reasons-- https://master.php.net/note/delete/110247
Reject -- https://master.php.net/note/reject/110247
Search -- https://master.php.net/manage/user-notes.php