I wonder how to change the code so that the demand does not come from webhosting, but from client-browser and in this case show how many "ms" the corresponding client-browser has to a particular website/server
<?
function ping($host, $port, $timeout) {
$tB = microtime(true);
$fP = fSockOpen($host, $port, $errno, $errstr, $timeout);
if (!$fP) { return "Server is down"; }
$tA = microtime(true);
return round((($tA - $tB) * 1000), 0)." ms";
}
//Echoing it will display the ping if the host is up, if not it'll say "down".
echo ping("google.com", 80, 10);
?>