public static function createKeyURL($string) { $string = Common::stripUnicode($string); $string = str_replace("/", "-", $string); $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\\-]/', '', $string); // Removes special chars. $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. return strtolower($string); }