Jump to content

array_filter inside a class will work ?


jaikar

Recommended Posts

Hi phpfreaks !!!!!....

 

i use a array_filer operation inside a class ... its not working .. its its outside a class as a seperate fuinction its working ...

 

this is the code .

 

	
class validate {
function precheck($val) {
	if(strtolower($val) != 'submit' && strtolower($val) != 'update') {
		return $val;
	}
}	
function filter($arr) {
	return (array_filter($arr, "$this->precheck")); 
}	
}	

 

the error says ... $this->precheck is not valid ... i tried with "precheck", "this->precheck", $precheck" nothing helps....

 

please advice

 

Thanks a lot in advance ...

 

~J

Link to comment
https://forums.phpfreaks.com/topic/43253-array_filter-inside-a-class-will-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.