@ 2020-10-17T15:45:43Z <?php
function slugify(string $input): string
{
$translitRules = [
":: Any-Latin",
":: [:Nonspacing Mark:] Remove",
":: [:Punctuation:] Remove",
":: [:Symbol:] Remove",
":: Latin-ASCII",
":: Lower()",
"' ' {' '} > ",
"::NULL",
"[:Separator:] > '-'",
];
$transliterator = \Transliterator::createFromRules(
implode(';', $translitRules)
);
return $transliterator->transliterate($input);
}
$title = '<?php François😎: _+ / Стравинский`😜.';
$slug = slugify($title);
var_dump($slug);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.2.0 - 7.2.34 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.32 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.30 , 8.2.0 - 8.2.25 , 8.3.0 - 8.3.13 string(24) "php-francois-stravinskij"
Output for 7.4.33 Fatal error: Uncaught Error: Class 'Transliterator' not found in /in/Hr0iJ:15
Stack trace:
#0 /in/Hr0iJ(22): slugify('<?php Fran\xC3\xA7ois...')
#1 {main}
thrown in /in/Hr0iJ on line 15
Process exited with code 255 . preferences:dark mode live preview
65.73 ms | 407 KiB | 5 Q