Convert a ‘safe’ url into words, for display on the page or inserting into a database

//
//   Convert a 'safe' url into words, for display on the page or inserting into a database
//
function purifyURL($url){
   $url = trim($url);

   $bannedChars = array("'",':','@');
   $url = str_replace($bannedChars, '', $url);

   $switchedChars = array('-','.','_');
   $url = str_replace($switchedChars, ' ', $url);

   $url = htmlspecialchars($url, ENT_QUOTES, 'utf-8');
   $url = strtolower($url); // all to lowercase
   $url = ucwords($url); // capitalise first characters
   $url = mysql_real_escape_string($url);

   return $url;
}

Related posts:

  1. Convert Text to ‘Safe Url’
  2. mysql_real_escape_string
  3. My Escape Data Function
  4. htmlspecialchars()
  5. Connect To Database With mysqli_connect

This post has had 4 views