I am trying to filter an array using the built-in array_filter
function. According to the examples in PHP manual, I have to provide the name of the callback function. So, here is what I tried:
// This function is a method
public function send($user_id, $access, $content, $aids)
{
// check if user is allowed to see the attachments
function is_owner($var)
{
return $this->attachment_owner($var, $user_id);
}
$aids = implode(';', array_filter(explode(';', $aids), 'is_owner'));
}
Here is the error I'm getting:
Fatal error: Using $this when not in object context in filename line number.
How to solve this?