3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait t { const parent = parent::class; const grandparent = self::parent::class; } class x { use t; // valid but just don't even think about using x::parent, } class y extends x { use t; } class z extends y { } echo y::parent; // x echo z::parent; // y
Output for git.master, git.master_jit
Fatal error: (expression)::class cannot be used in constant expressions in /in/4s7KM on line 5 Stack trace: #0 {main}
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:
48.02 ms | 707 KiB | 3 Q