Let's assume we have following situation:
<?php
class MyFilterClass {
public function filter(array $arr) {
return array_map(function($value) {
return $this->privateFilterMethod($value);
});
}
private function privateFilterMethod($value) {
if (is_numeric($value)) $value++;
else $value .= '.';
}
}
?>
This will work, because $this inside anonymous function (unlike for example javascript) is the instance of MyFilterClass inside which we called it.
I hope this would be useful for anyone.