public function clean($domain)
    {
        $domain = trim($domain);
        $domain = preg_replace('#^https?://#', '', $domain);
        if (substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);

        return $domain;
    }
public function clean($domain)
    {
        $domain = trim($domain);
        $domain = preg_replace('#^https?://#', '', $domain);
        if (substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);

        return $domain;
    }
public function clean ( $ domain ) { $ domain = trim ( $ domain ) ; $ domain = preg_replace ( '#^https?://#' , '' , $ domain ) ; if ( substr ( strtolower ( $ domain ) , 0 , 4 ) == "www." ) $ domain = substr ( $ domain , 4 ) ; return $ domain ; }
Cleans domain name of empty spaces, www, http and https.

@param string $domain Domain name

@return string
Cleans domain name of empty spaces www http and https .