3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function decode(string $phrase): string { $dictionary = [ 1 => 'а', 2 => 'е', 3 => 'ё', 4 => 'и', 5 => 'й', 6 => 'о', 7 => 'у', 8 => 'э', 9 => 'ю', 10 => 'я', 11 => 'б', 12 => 'в', 13 => 'г', 14 => 'д', 15 => 'ж', 16 => 'з', 17 => 'к', 18 => 'л', 19 => 'м', 20 => 'н', 21 => 'п', 22 => 'р', 23 => 'с', 24 => 'т', 25 => 'ф', 26 => 'х', 27 => 'ц', 28 => 'ч', 29 => 'ш', 30 => 'щ', 31 => 'ь', 32 => 'ы', 33 => 'ъ', ]; $words = explode(' ', $phrase); $result = ''; foreach ($words as $word) { $letters = explode('.', $word); $result .= ' ' . implode('', array_map(function ($value) use ($dictionary) { $index = (int) $value; if ($index < 1 || $index > 33) { return $value; } return $dictionary[(int)$value]; }, $letters)); } return $result; } echo decode('12.6.24 21.6.28.2.19.7 19.20.2 17.728.29.2 11.32.24.31 6.12.20.6.19.76.19.4 6.23.7.15.14.1.9.24 19.2.20.10 21.22.2.15.12.3 , 28.2.19 7.16.20.1.9.24.');
based on cJQKl
Output for hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
вот почему мне к728ше быть овном76ми осуждают меня прежвё , чем узнают
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/k0aut on line 3
Process exited with code 255.