|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-02 09:58 UTC] sterling@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 02:00:01 2025 UTC |
Description: ------------ A callback function of array_filter in a class dosen't allow the use of $this. Reproduce code: --------------- class test { var $filter = '' //is a regex var $array; //has many values function test() { array_filter($array, array($this, 'filter')); } function filter( $value ) { return preg_match("/$this->filter/i", $value); } } Expected result: ---------------- The array should be filtered after the regex of the $this->filter value; Actual result: -------------- Fatal error: Using $this when not in object context