UDP is a connectionless protocol running over IP that is mainly used for broadcasting messages, popular services that use UDP include NFS, SNMP and DNS.

<?php
$sock 
socket_open(AF_INETSOCK_DGRAM0);
if(
$sock 0) {
    echo 
"socket() failed, error:" strerror($sock) . "\n";
}

$opt_ret socket_set_option($sockSOL_SOCKETSO_BROADCAST1);
if(
$opt_ret 0) {
    echo 
"setsockopt() failed, error: " 
         
strerror($opt_ret) . "\n";
}

$send_ret socket_sendto($sock
                          
$broadcast_string
                          
strlen($broadcast_string),
                          
0
                          
'255.255.255.255'
                          
4096);
if(
$send_ret 0) {
    echo 
"sendto() failed, error:" strerror($send_ret) . "\n";
}

socket_close($sock);
?>