3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'Namnet på bildtävlingen'; $string = "--My----string hello---"; $rules = <<<'RULES' :: Any-Latin; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC; :: [^-[:^Punctuation:]] Remove; :: Lower(); [:^L:] { [-] > ; [-] } [:^L:] > ; [-[:Separator:]]+ > '-'; RULES; $slug = \Transliterator::createFromRules($rules) ->transliterate( $string ); echo $slug;
Output for 8.5.0 - 8.5.3
Fatal error: Uncaught Error: Class "Transliterator" not found in /in/FAJAW:18 Stack trace: #0 {main} thrown in /in/FAJAW on line 18
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
my-string-hello

preferences:
79.06 ms | 1237 KiB | 4 Q