Make text net safe


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function makeInternetSafe($text) {
  2.  
  3. $text = stripslashes($text);
  4. $text = mb_strtolower($text, 'utf-8');
  5.  
  6. $forbidden = array('Ä', 'Ö', 'Å', 'ä', 'ö', 'å', ' ', '#');
  7. $replace = array('A', 'O', 'a', 'a', 'o', 'a', '_', '-');
  8. $text = str_replace($forbidden, $replace, $text);
  9.  
  10. $text = preg_replace('#[^a-z0-9._-]#', '', $text);
  11.  
  12. return $text;
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.