3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (strnatcmp(phpversion(),'5.4.7') >= 0) { $address="127.0.0.1"; $port=9877; echo "I am here"; set_time_limit (0); if(false==($socket= socket_create(AF_INET,SOCK_STREAM, SOL_TCP))) { echo "could not create socket"; } socket_bind($socket, $address, $port) or die ("could not bind socket"); socket_listen($socket); if(($client=socket_accept($socket))) echo "client is here"; sleep(60); socket_close($socket); } ?>
Output for 7.0.20 - 7.2.0
I am here Fatal error: Uncaught Error: Call to undefined function socket_create() in /in/G7Yqn:8 Stack trace: #0 {main} thrown in /in/G7Yqn on line 8
Process exited with code 255.
Output for 5.2.12 - 5.4.6