3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (strnatcmp(phpversion(),'5.4.7') >= 0) { $host="127.0.0.1" ; $port=9876; $timeout=30; $sk=fsockopen($host,$port,$errnum,$errstr,$timeout) ; if (!is_resource($sk)) { exit("connection fail: ".$errnum." ".$errstr) ; } else { echo "Connected"; } } ?>
Output for 5.4.7 - 5.6.28, 7.0.0 - 7.1.0
Warning: fsockopen(): unable to connect to 127.0.0.1:9876 (Connection refused) in /in/lujmQ on line 7 connection fail: 111 Connection refused
Output for hhvm-3.10.0 - 3.12.0
Warning: failed to connect to 127.0.0.1 [111]: Connection refused in /in/lujmQ on line 7 connection fail: 111 Connection refused
Output for 4.3.0 - 5.4.6