Hi!
how can I express the "XXX" if I dont want to display some special IPs with a special IP-part
e.g.:

if ($IP != 217.168.48.xxx and $IP != 217.168.58.xxx)
{
echo $IP;
}

So i want to display every IP, except those from "217.168.48.xxx" and "217.168.58.xxx"

But i dont know how to express the "xxx" or how to discribe it with a variable like "217.168.48.$x"
What do i have to write for "$x", when "$x" is a number from 1 to 255 ?

Many many thanks in advance!

    Try this 🙂

    
    <?php
    
    $ip = '217.168.48.1';
    
    $network_id_1 = '217.168.48';
    
    $network_id_2 = '217.168.58';
    
    list($a, $b, $c, $d) = explode('.', $ip);
    
    $reconstructed_ip = $a . '.' . $b . '.' . $c;
    
    if ($reconstructed_ip != $network_id_1 and $reconstructed_ip != $network_id_2) {
    
    echo $ip;
    
    }
    
    ?>
    
    

    untested but should work 🙂

    Jonno

      Write a Reply...