public function ping($host = '', $port = 80)
    {
        $start  = microtime(true);
        $file   = @fsockopen($host, $port, $errno, $errstr, 5);
        $stop   = microtime(true);
        $status = 0;

        if (!$file) {
            $status = -1;
        } else {
            fclose($file);
            $status = round((($stop - $start) * 1000), 2);
        }
        return $status;
    }
public function ping($host = '', $port = 80)
    {
        $start  = microtime(true);
        $file   = @fsockopen($host, $port, $errno, $errstr, 5);
        $stop   = microtime(true);
        $status = 0;

        if (!$file) {
            $status = -1;
        } else {
            fclose($file);
            $status = round((($stop - $start) * 1000), 2);
        }
        return $status;
    }
public function ping ( $ host = '' , $ port = 80 ) { $ start = microtime ( true ) ; $ file = @ fsockopen ( $ host , $ port , $ errno , $ errstr , 5 ) ; $ stop = microtime ( true ) ; $ status = 0 ; if ( ! $ file ) { $ status = - 1 ; } else { fclose ( $ file ) ; $ status = round ( ( ( $ stop - $ start ) * 1000 ) , 2 ) ; } return $ status ; }
Ping a server and return timing

@return float
Ping a server and return timing