3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace namespace_breaks_mario_solution_but_not_hans_solution; class C { public const WUT=5; } $v = "WUT"; var_dump(constant(C::class . "::$v")); // << hans solution var_dump(constant("C::$v")); // << mario solution, crash in namespace
Output for git.master_jit, git.master, rfc.property-hooks
int(5) Fatal error: Uncaught Error: Class "C" not found in /in/SUYbi:8 Stack trace: #0 /in/SUYbi(8): constant('C::WUT') #1 {main} thrown in /in/SUYbi on line 8
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:
26.94 ms | 405 KiB | 5 Q