3v4l.org

run code in 300+ PHP versions simultaneously
<?php class template { public $property = 'hello'; } class object { public $template; public $hello = 'hi'; } $object = new object(); $object->template = new template(); $path = $object->template->property; $value = $object->{$path}; print_r($value);

preferences:
49.27 ms | 402 KiB | 5 Q