8 lines
256 B
PHP
8 lines
256 B
PHP
<?php
|
|
function sanitizeMediaString(string $str): string
|
|
{
|
|
$sanitizedString = preg_replace("/[^a-zA-Z0-9\s-]/", "", iconv("UTF-8", "ASCII//TRANSLIT", $str));
|
|
|
|
return strtolower(trim(preg_replace("/[\s-]+/", "-", $sanitizedString), "-"));
|
|
}
|
|
?>
|