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; ?>
Output for 7.0.0 - 7.1.0
Hello World Fatal error: Uncaught Error: Call to undefined function socket_create() in /in/ZVDHv:7 Stack trace: #0 {main} thrown in /in/ZVDHv on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/ZVDHv on line 8 Warning: socket_set_option() expects parameter 3 to be integer, string given in /in/ZVDHv on line 8
Process exited with code 137.
Output for 5.4.0 - 5.6.21
Hello World Fatal error: Call to undefined function socket_create() in /in/ZVDHv on line 7
Process exited with code 255.
Output for 4.3.2, 4.3.4, 4.3.6, 4.3.8, 4.4.2 - 4.4.5, 4.4.7, 5.0.1 - 5.1.0, 5.1.3, 5.2.0, 5.2.3, 5.2.5 - 5.2.7, 5.2.9, 5.2.13 - 5.2.16, 5.3.0 - 5.3.1, 5.3.5, 5.3.7, 5.3.9, 5.3.11, 5.3.13, 5.3.15, 5.3.17, 5.3.19, 5.3.21, 5.3.23, 5.3.25, 5.3.27, 5.3.29
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/ZVDHv on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/ZVDHv on line 8
Process exited with code 137.
Output for 5.0.0, 5.1.1 - 5.1.2, 5.1.4 - 5.1.6, 5.2.1 - 5.2.2, 5.2.4, 5.2.8, 5.2.10 - 5.2.12, 5.2.17, 5.3.2 - 5.3.4, 5.3.6, 5.3.8, 5.3.10, 5.3.12, 5.3.14, 5.3.16, 5.3.18, 5.3.20, 5.3.22, 5.3.24, 5.3.26, 5.3.28
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/ZVDHv on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/ZVDHv on line 8 Warning: socket_bind(): unable to bind address [98]: Address already in use in /in/ZVDHv on line 9
Process exited with code 137.
Output for 4.3.3, 4.3.5, 4.3.7, 4.3.9 - 4.4.1, 4.4.6, 4.4.8 - 4.4.9
Hello World Notice: Use of undefined constant MCAST_JOIN_SOURCE_GROUP - assumed 'MCAST_JOIN_SOURCE_GROUP' in /in/ZVDHv on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/ZVDHv on line 8 Warning: socket_bind() unable to bind address [98]: Address already in use in /in/ZVDHv on line 9
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/ZVDHv on line 8 Warning: socket_set_option() expects parameter 3 to be long, string given in /in/ZVDHv on line 8
Process exited with code 139.