3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { static const LABELS = [ 'a' => 'Hello', 'b' => 'World' ]; static const UNKNOWN_LABEL = 'unknown'; public static function test($module) { self::LABELS[$module] ?? self::UNKNOWN_LABEL; } } $a = []; $a[] = x::test('a'); $a[] = x::test('b'); $a[] = x::test('c'); $a[] = x::test(null); var_dump($a);
Output for git.master_jit, git.master, rfc.property-hooks
Fatal error: Cannot use the static modifier on a class constant in /in/qSLJC on line 5
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:
49.41 ms | 2797 KiB | 3 Q