3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo 'Hello World'; $socket= socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_set_option($socket, SOL_SOCKET, MCAST_JOIN_SOURCE_GROUP, array("group"=>"239.194.0.73","interface"=>"eth0","source"=>"239.194.0.73")); $binded = socket_bind($socket, '0.0.0.1', 6073); //receive data $from = '192.168.0.1'; $port = 4824; socket_recvfrom($socket, $buf, 12, MSG_WAITALL, $from, $port); echo "Received $buf from remote address $from and remote port $port" . PHP_EOL; ?> <?php echo 'Hello World'; ?>

Abusive script

This script was stopped while abusing our resources

Output for 7.0.0 - 7.0.12
Hello World Fatal error: Uncaught Error: Call to undefined function socket_create() in /in/tHJRH:7 Stack trace: #0 {main} thrown in /in/tHJRH on line 7
Process exited with code 255.
Output for 5.4.0 - 5.6.26
Hello World Fatal error: Call to undefined function socket_create() in /in/tHJRH on line 7
Process exited with code 255.
Output for 4.3.2 - 5.3.29
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/tHJRH on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/tHJRH on line 8
Process exited with code 137.
Output for 4.3.0 - 4.3.1
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/tHJRH on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/tHJRH on line 8
Process exited with code 139.