coryd.dev/api/Utils/media.php

14 lines
292 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), "-")
);
}
?>