3v4l.org

run code in 300+ PHP versions simultaneously
<?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'; ?>
Output for 7.0.0 - 7.0.12, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.3 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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.4.45, 5.5.0 - 5.5.38, 5.6.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 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 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.

preferences:
233.47 ms | 401 KiB | 346 Q