3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function x(): int { return 5; } } $cl = get_class(new class() { public function x(): int { return 6; } }); $createProxy = function(string $class): string { $resName = 'Proxy_' . md5($class); class_alias($class, $resName . '_alias'); eval('class ' . $resName . ' extends ' . $resName . '_alias { public function x(): int { return 7; } }'); return $resName; }; $proxyCl = $createProxy($cl); var_dump((new $cl)->x()); var_dump((new $proxyCl)->x());
Output for git.master_jit, git.master, rfc.property-hooks
int(6) int(7)

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:
58.66 ms | 405 KiB | 5 Q