array_filter
| From: | David Otton | Date: | Tue, 25 Feb 2003 07:59:47 +0000 |
| Subject: | array_filter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137044@lists.php.net to get a copy of this message | ||
I suspect this can't be done in PHP. However...
Is it possible to pass additional parameters to the callback function
used by array_filter()?
I guess I'm looking for something functionally equivalent to this Python
code:
from string import count
list = ('apple', 'avacado', 'banana', 'blueberry',
'peach', 'persimmon')
strings = ['a', 'b', 'c', 'd', 'e', 'f']
for string in strings :
print filter(lambda x : count(x, string), list)