domain age
<?php function domain_age($domain) { // TODO: return the age of the domain in years $whois = "whois $domain"; $txt = shell_exec($whois); $start = explode("Creation Date: ", $txt); $end = explode("\n", $start[1]); $date = $end[0]; $date_array = explode("/", $date); $year = $date_array[2]; $current_year = date("Y"); $age = $current_year - $year; return $age; } echo domain_age("google.com"); // returns "18" echo domain_age("bbc.co.uk"); // returns "28" echo domain_age("github.com"); // returns "9" echo domain_age("facebook.com"); // returns "13"