<?php
class Foo
{
public function foo()
{
die('test');
}
public function test()
{
$closure = function() {
$this->foo();
};
$closure();
}
}
$foo = new Foo;
$foo->test();
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/OL8GP on line 3
test