note 29426 deleted from function.split by didou
| From: | didou@php.net | Date: | Sat, 16 Aug 2003 16:25:50 +0000 |
| Subject: | note 29426 deleted from function.split by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54413@lists.php.net to get a copy of this message | ||
Note Submitter: satan@bizmedia.pl
----
There are two function to encode and decode ip. It will be usefull to collect logs in smaler file
size.
$ip = "222.222.222.222";
function EncodeIP($ip)
{
$ipt = split("\.",$ip);
return chr($ipt[0]).chr($ipt[1]).chr($ipt[2]).chr($ipt[3]);
}
function DecodeIP($cip)
{
$ipt = split(";",chunk_split($cip,1,";"));
return
ord($ipt[0]).".".ord($ipt[1]).".".ord($ipt[2]).".".ord($ipt[3]);
}