Untitled
unknown
plain_text
a year ago
931 B
6
Indexable
function removeAccents($string) {
$search = [
'á', 'í', 'ó', 'ú', 'é', 'ñ', 'ü',
'Á', 'Í', 'Ó', 'Ú', 'É', 'Ñ', 'Ü',
'à', 'è', 'ì', 'ò', 'ù',
'À', 'È', 'Ì', 'Ò', 'Ù'
];
$replace = [
'a', 'i', 'o', 'u', 'e', 'n', 'u',
'A', 'I', 'O', 'U', 'E', 'N', 'U',
'a', 'e', 'i', 'o', 'u',
'A', 'E', 'I', 'O', 'U'
];
return str_replace($search, $replace, $string);
}
// Funzioni helper
function loadJsonFile($filePath) {
return file_exists($filePath) ? json_decode(file_get_contents($filePath), true) : [];
}
function saveJsonFile($filePath, $data) {
file_put_contents($filePath, json_encode($data));
}
function removeSpecialCharacters($string) {
return preg_replace('/[#\/*()\-\+]/', '', $string);
}
foreach ($_POST as $key => $value) {
if (is_string($value)) {
$_POST[$key] = removeAccents($value);
}
}Editor is loading...
Leave a Comment