3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class A { protected const c = null; abstract protected static function fs(); abstract protected function f(); } class B extends A { public function __construct(C $c) { var_dump(C::fs()); var_dump($c->f()); var_dump(C::C); } protected static function fs() {} protected function f() {} } class C extends A { protected const C = 'C::C'; protected static function fs() { return __METHOD__; } protected function f() { return __METHOD__; } } new B(new C);
Output for git.master, git.master_jit, rfc.property-hooks
string(5) "C::fs" string(4) "C::f" Fatal error: Uncaught Error: Cannot access protected constant C::C in /in/2lU3i:15 Stack trace: #0 /in/2lU3i(33): B->__construct(Object(C)) #1 {main} thrown in /in/2lU3i on line 15
Process exited with code 255.

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:
55.41 ms | 401 KiB | 8 Q