Yngvarr

Generation

generate functionSun, 19 Mar 2023

get tdl with domain

function get_tdl($url) { // strip http:// and www. $tld = preg_replace("/^(https?:\/\/)?(www\.)?/i", "", $url); // strip everything else $tld = preg_replace("/\/.*$/", "", $tld); // extract and return tld $tld = substr($tld, strrpos($tld, ".") + 1); return $tld; }

Questions about programming?Chat with your personal AI assistant