fork download
  1. <?php
  2.  
  3. function removeSpecialChars($string){
  4. //List (Array) of special chars
  5. $pattern = array("/([áàãâä])/","/([ÁÀÃÂÄ])/","/([éèêë])/","/([ÉÈÊË])/","/([íìîï])/","/([ÍÌÎÏ])/","/([óòõôö])/","/([ÓÒÕÔÖ])/","/([úùûü])/","/([ÚÙÛÜ])/","/(ñ)/","/(Ñ)/","/(ç)/","/(Ç)/","/([\\'\\\"\\^\\~\\;\\:\\°\\?\\&\\*\\+\\@\\#\\$\\%\\!\\\\\\/\\(\\)\\|\\=\\.\\,])/");
  6.  
  7. //List (Array) of letters
  8. $replacement = array('a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U', 'n', 'N', 'c', 'C', '');
  9.  
  10. return preg_replace($pattern , $replacement, $string);
  11. }
  12.  
  13. echo removeSpecialChars("áçõ/\\?&");
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
aaa�ao