|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-23 20:07 UTC] torben@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
There is no way to safely use array filter from within a class. Using class::functionname should work for the callback function as in: <?php class test { function filter($var) { return preg_match('/test/',$var); } } $array["test"]="This is a test"; $array["not"]="This shouldn't be here"; $array = array_filter($array, "test::filter"); print_r($array); ?> but this just says: Warning: array_filter() expects argument 2, 'test::filter', to be a valid callback in /usr/home/ribrdb/web/php/classtest.php on line 11