<?php
class MyClass
{
private $prop = "teste";
public function test()
{
$class = new class($this->prop) {
public function __construct($prop)
{
$this->prop = $prop;
}
public function run()
{
echo $this->prop, PHP_EOL;
}
};
$class->run();
}
}
$obj = new MyClass();
$obj->test();
PD9waHAKCmNsYXNzIE15Q2xhc3MKewoJcHJpdmF0ZSAkcHJvcCA9ICJ0ZXN0ZSI7CgkKICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0KCkKICAgIHsKICAgICAgICAkY2xhc3MgPSBuZXcgY2xhc3MoJHRoaXMtPnByb3ApIHsKCiAgICAgICAgICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkcHJvcCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgJHRoaXMtPnByb3AgPSAkcHJvcDsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgcHVibGljIGZ1bmN0aW9uIHJ1bigpIAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlY2hvICR0aGlzLT5wcm9wLCBQSFBfRU9MOwogICAgICAgICAgICB9CgogICAgICAgIH07CiAgICAgICAgCiAgICAgICAgJGNsYXNzLT5ydW4oKTsKICAgIH0KfQoKJG9iaiA9IG5ldyBNeUNsYXNzKCk7CiRvYmotPnRlc3QoKTs=