3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ping($host, $port, $timeout) { $tB = microtime(true); $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); if (!$fP) { return "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("www.google.com", 80, 10);

preferences:
34.79 ms | 402 KiB | 5 Q