Filtro de URL de webiste con pregx

    $url = "https://www.azonedev.com";
    $url_to_main_domain = preg_replace('/(https|http|:|\/\/|www.|\s)/i','',$url);
    $remove_sub_dir_from_url = preg_replace('/(\/).*/','',$url_to_main_domain);
    echo $remove_sub_dir_from_url;
azonedev