3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'This, is - - the URL!', 'Holmes & Yoyo', 'L’Œil de démon', 'How to win 1000€?', '€, $ & other currency symbols', 'Und die Katze fraß alle mäuse.', 'Белите рози на София', 'പോണ്ടിച്ചേരി സൂര്യനു കീഴിൽ', ]; $rules = <<<'RULES' # Transliteration :: Any-Latin ; :: Latin-Ascii ; # examples of custom replacements '&' > ' and ' ; [^0-9][01]? { € > ' euro' ; € > ' euros' ; [^0-9][01]? { '$' > ' dollar' ; '$' > ' dollars' ; :: Null ; # slugify [^[:alnum:]&[:ascii:]]+ > '-' ; :: Lower ; # trim [$] { '-' > &Remove() ; '-' } [$] > &Remove() ; RULES; $tsl = Transliterator::createFromRules($rules, Transliterator::FORWARD); $results = array_map(fn($s) => $tsl->transliterate($s), $strings); print_r($results);
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
Array ( [0] => this-is-the-url [1] => holmes-and-yoyo [2] => l-oeil-de-demon [3] => how-to-win-1000-euros [4] => euro-dollar-and-other-currency-symbols [5] => und-die-katze-frass-alle-mause [6] => belite-rozi-na-sofia [7] => peanticceri-suryanu-kili )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( [0] => this-is-the-url [1] => holmes-and-yoyo [2] => l-oeil-de-demon [3] => how-to-win-1000-euros [4] => euro-dollar-and-other-currency-symbols [5] => und-die-katze-frass-alle-mause [6] => belite-rozi-na-sofia [7] => peanticceri-suryanu-kili )
Output for 8.0.13
Fatal error: Uncaught Error: Class "Transliterator" not found in /in/FF64S:33 Stack trace: #0 {main} thrown in /in/FF64S on line 33
Process exited with code 255.
Output for 7.4.26, 7.4.33
Fatal error: Uncaught Error: Class 'Transliterator' not found in /in/FF64S:33 Stack trace: #0 {main} thrown in /in/FF64S on line 33
Process exited with code 255.
Output for 7.3.0 - 7.3.33
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /in/FF64S on line 34
Process exited with code 255.

preferences:
139.03 ms | 401 KiB | 156 Q