note 32586 modified in function.ip2long by danbrown

From: Date: Fri, 05 Dec 2008 13:47:10 +0000
Subject: note 32586 modified in function.ip2long by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147710@lists.php.net to get a copy of this message
Yet another word on IP_Match here is the complete functions as described by php-net at dreams4net dot com on 08-Aug-2002 09:31 <?php # determine if an IP address is within # a particular network with mask function IP_Match($network, $mask, $ip) { $ip_long=ip2long($ip); $network_long=ip2long($network); $mask_long=ip2long($mask); if (($ip_long & $mask_long) == $network_long) { return true; } else { return false; } } ?> Thank you, it is simple, fast, and best of all works! --was-- Yet another word on IP_Match here is the complete functions as described by php-net at dreams4net dot com on 08-Aug-2002 09:31 # determine if an IP address is within # a particular network with mask function IP_Match($network, $mask, $ip) { $ip_long=ip2long($ip); $network_long=ip2long($network); $mask_long=ip2long($mask); if (($ip_long & $mask_long) == $network_long) { return true; } else { return false; } } Thank you, it is simple, fast, and best of all works! http://php.net/manual/en/function.ip2long.php

« previous php.notes (#147710) next »