3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { const LABELS = [ 'a' => 'Hello', 'b' => 'World' ]; const UNKNOWN_LABEL = 'unknown'; public static function test($module) { return 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
Deprecated: Using null as an array offset is deprecated, use an empty string instead in /in/msg5M on line 13 array(4) { [0]=> string(5) "Hello" [1]=> string(5) "World" [2]=> string(7) "unknown" [3]=> string(7) "unknown" }
Output for rfc.property-hooks
array(4) { [0]=> string(5) "Hello" [1]=> string(5) "World" [2]=> string(7) "unknown" [3]=> string(7) "unknown" }

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:
56.15 ms | 2799 KiB | 4 Q