php中的匿名接口实现

In Java we can do like this..

interface Inter {
    public void run()
}

class Test {
    public Test(Inter inter){
        inter.run();
    }
}

new Test(new Inter() {
    @Override
    public void run() {
        //Some Task;
    }
}

But in php I got error while doing like this. Isn't it possible to do this in php?

A little late, but you can do this in php:

new Test(new class implements Inter {
    public function run()
    {
        // Some Task;
    }
});