3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Bug10577; use function PHPStan\Testing\assertType; class HelloWorld { private const MAP = [ '10' => 'Test1', '20' => 'Test2', ]; public function validate(string $value): void { $value = trim($value); if ($value === '') { throw new \RuntimeException(); } $value = self::MAP[$value] ?? $value; var_dump($value); var_dump(self::MAP[$value]); // ... } } $h = new HelloWorld(); $h->validate('something');
Output for git.master_jit, git.master, rfc.property-hooks
string(9) "something" Warning: Undefined array key "something" in /in/WD7OG on line 27 NULL

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:
31.71 ms | 405 KiB | 5 Q