Exemple #1
0
 function bINHEx($_▀┤я)
 {
     return deChEX(binDec($_▀┤я));
 }
Exemple #2
0
function ip_addr_network_add_sub($network, $sub_ip)
{
    # simple OR for 2 binary strings, eg.
    #    11000000101010000000000100000000
    #    00000000000000000000000010000010
    # => 11000000101010000000000110000010
    $binary_net = ip_addr_decbin(ip_addr_dec($network));
    $binary_sub = ip_addr_decbin(ip_addr_dec($sub_ip));
    if (strLen($binary_net) != 32 || strLen($binary_sub) != 32) {
        return false;
    }
    $binary_ip = '';
    for ($i = 0; $i < 32; ++$i) {
        $binary_ip .= $binary_net[$i] == '1' || $binary_sub[$i] == '1' ? '1' : '0';
    }
    $ip = long2ip(binDec($binary_ip));
    return $ip ? $ip : false;
}