3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static function noClosure() { echo 'Context of '.get_called_class().', no closure: '; echo Left::$prot; echo "\n"; } public static function withClosure() { echo 'Context of '.get_called_class().', with closure: '; $cl = function(){ echo Left::$prot; echo "\n"; }; $cl(); } } class Left extends Base { protected static $prot = 'works.'; } class Right extends Base { public static function direct() { echo 'Directly from Right: '; echo Left::$prot; echo "\n"; } } Right::direct(); Base::noClosure(); Right::noClosure(); Base::withClosure(); Right::withClosure();
Output for git.master, git.master_jit, rfc.property-hooks
Directly from Right: Fatal error: Uncaught Error: Cannot access protected property Left::$prot in /in/h0Tth:26 Stack trace: #0 /in/h0Tth(31): Right::direct() #1 {main} thrown in /in/h0Tth on line 26
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:
38.63 ms | 401 KiB | 8 Q