3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum WeekDay: string { case Monday = 'monday'; case Tuesday = 'tuesday'; case Wednesday = 'wednesday'; case Thursday = 'thursday'; case Friday = 'friday'; case Saturday = 'saturday'; case Sunday = 'sunday'; } class Foo { public function hello() { return "Hello world" . PHP_EOL; } } $array = []; $array[WeekDay::Monday->value] = new Foo(); // etc echo $array[WeekDay::Monday->value]->hello(); $map = new WeakMap(); $map[WeekDay::Monday] = new Foo(); // etc echo $map[WeekDay::Monday]->hello();
Output for git.master_jit, git.master
Hello world Hello world

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.64 ms | 842 KiB | 4 Q