3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_calling_scope() { return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['class'] ?? null; } class Foo { public function __get($name) { var_dump(get_calling_scope()); return ''; } public function test() { $this->bar; } } class Bar extends Foo { public function __get($name) { parent::__get($name); return ''; } } $foo = new Foo(); $foo->bar; $foo->test(); $bar = new Bar(); $bar->test();
Output for git.master_jit, git.master, rfc.property-hooks
NULL string(3) "Foo" string(3) "Bar"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.38 ms | 1113 KiB | 4 Q