3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyMorse { private array $plainTextsByMorseCode = [ '.-' => 'A', '....' => 'H', '.-..' => 'L', '-.' => 'N', '---' => 'O', '.--.' => 'P', '...' => 'S', '-' => 'T', '..-' => 'U', '-.--' => 'Y', ]; public function decode(string $morseCode): string { return strtr( preg_replace_callback('/[.-]+/', fn($m) => $this->plainTextsByMorseCode[$m[0]], $morseCode), [' ' => ' ', ' ' => ''] ); } } $obj = new MyMorse(); var_export( $obj->decode('-.-- --- ..- ... .... .- .-.. .-.. -. --- - .--. .- ... ...') );
Output for git.master_jit, git.master, rfc.property-hooks
'YOU SHALL NOT PASS'

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