1 Replies - 2805 Views - Last Post: 22 February 2011 - 03:09 PM Rate Topic: -----

#1 Jstall  Icon User is offline

  • Lurker
  • member icon

Reputation: 434
  • View blog
  • Posts: 1,042
  • Joined: 08-March 09

array_filter not recognizing callback

Posted 22 February 2011 - 02:57 PM

Hello all,

I am having an issue with array_filter recognizing my callback function. It works on my local machine but not on my development and was hoping someone could point me in the right direction as to why. This is how I was using it :

private function some_function()
 $arr = array('value','value','value');
 $arr = array_filter($arr,'ClassName::filter_function');


public filter_function($element)
 //do stuff and return 

This worked fine on my local machine but when I uploaded it to a test server I get the message "Warning
array_filter(): The second argument, 'ClassName::filter_function', should be a valid callback in path/to/file.

I have tried to change it to
 $arr = array_filter($arr,array($this,'filter_function'));

as well as
$arr = array_filter($arr,array('ClassName','filter_function'));

But to now avail. The last two my local machine didn't like either. The machines ARE running different versions of PHP, my local is 5.3.1 and the hosted is 5.2.14 however I haven't read anything that suggests this should be an issue in this case.

Could anyone suggest another way I could make this work or have an idea what could be going wrong? Any help is appreciated. Thanks much!

Edit : And after all that I realize I am a moron who forgot up the last change I made to the server from local.

Does indeed work as it should. All is well and I am embarrassed. Thanks :stupid:

This post has been edited by Jstall: 22 February 2011 - 03:05 PM

Is This A Good Question/Topic? 0
  • +

Replies To: array_filter not recognizing callback

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5186
  • View blog
  • Posts: 13,916
  • Joined: 18-April 07

Re: array_filter not recognizing callback

Posted 22 February 2011 - 03:09 PM

nvr mind, you obviously fixed it. :)

This post has been edited by Martyr2: 22 February 2011 - 03:10 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1