3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Model { protected static $__columns = []; protected static $cache = []; public function test() { $modelName = get_class($this); var_dump($modelName::$cache); static::$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
array(0) { } array(3) { [0]=> string(3) "aaa" [1]=> string(2) "aa" [2]=> string(1) "a" } array(3) { [0]=> string(3) "aaa" [1]=> string(2) "aa" [2]=> string(1) "a" } array(3) { [0]=> string(3) "bbb" [1]=> string(2) "bb" [2]=> string(1) "b" } array(3) { [0]=> string(3) "bbb" [1]=> string(2) "bb" [2]=> string(1) "b" } array(3) { [0]=> string(3) "aaa" [1]=> string(2) "aa" [2]=> string(1) "a" }

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:
51.59 ms | 402 KiB | 8 Q