3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { private static ? int $in = null; public static function in() : int { if (empty(self::$in)) { self::$in = rand(0,10); } return self::$in; } } class A { use T; } class B { use T; } var_dump(A::in(), B::in());
Output for git.master_jit
int(1) int(4)
Output for git.master
int(8) int(0)

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:
30.6 ms | 406 KiB | 5 Q