From: [EMAIL PROTECTED] Operating system: linux PHP version: 4.1.1 PHP Bug Type: Arrays related Bug description: array_filter does not work withing classes
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 -- Edit bug report at http://bugs.php.net/?id=15694&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15694&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15694&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15694&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15694&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15694&r=support Expected behavior: http://bugs.php.net/fix.php?id=15694&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15694&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15694&r=submittedtwice