3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Model { protected static $__columns = []; protected static $cache = []; public function test() { var_dump($modelName::$cache); $modelName = get_class($this); $modelName::$cache = $modelName::$__columns; var_dump($modelName::$cache); } } class A extends Model { protected static $__columns = ["aaa", "aa", "a"]; } class B extends Model { protected static $__columns = ["bbb", "bb", "b"]; } $a = new A(); $a->test(); $b = new B(); $b->test(); $a->test();
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $modelName in /in/BHup4 on line 9 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/BHup4:9 Stack trace: #0 /in/BHup4(26): Model->test() #1 {main} thrown in /in/BHup4 on line 9
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:
58.17 ms | 401 KiB | 8 Q