3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function diacriticsToNumbers($str) { $replace = [ '+' => 1, 'ě' => 2, 'š' => 3, 'č' => 4, 'ř' => 5, 'ž' => 6, 'ý' => 7, 'á' => 8, 'í' => 9, 'é' => 0, 'Ě' => 2, 'Š' => 3, 'Č' => 4, 'Ř' => 5, 'Ž' => 6, 'Ý' => 7, 'Á' => 8, 'Í' => 9, 'É' => 0, ]; return strtr($str, $replace); } echo diacriticsToNumbers('áéé ššé éýž');
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
800 330 076
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/CD6PM on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/CD6PM on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/CD6PM on line 4
Process exited with code 255.