3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $host = 'google.com'; if(fsockopen($host, 80, $errno, $errstr, 30)) { echo 'online!'; fclose($socket); } else { echo 'offline.'; } ?>
based on vMpoF
Output for 7.0.20, 7.1.5 - 7.3.0alpha1
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/9JKDX on line 3 Warning: fsockopen(): unable to connect to google.com:80 (php_network_getaddresses: getaddrinfo failed: System error) in /in/9JKDX on line 3 offline.
Output for 5.6.0 - 7.0.10, 7.1.0
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/9JKDX on line 3 Warning: fsockopen(): unable to connect to google.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/9JKDX on line 3 offline.