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=9878; $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 - 7.1.0
Warning: fsockopen(): unable to connect to 127.0.0.1:9878 (Connection refused) in /in/8lqg5 on line 7 connection fail: 111 Connection refused
Output for 4.3.0 - 5.4.6