I need to call a function inside a method. This function needs access to a private property. This code:
class tc {
private $data=123;
public function test() {
function test2() {
echo $this->data;
}
test2();
}
}
$a=new tc();
$a->test();
returns the following error:
Fatal error: Using $this when not in object context in ... on line ...
Using PHP 5.6.38. How can I do this?