note 29426 added to function.split
| From: | satan at bizmedia dot pl | Date: | Thu, 13 Feb 2003 10:31:52 +0000 |
| Subject: | note 29426 added to function.split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43872@lists.php.net to get a copy of this message | ||
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]);
}
--
http://www.php.net/manual/en/function.split.php
http://master.php.net/manage/user-notes.php?action=edit+29426
http://master.php.net/manage/user-notes.php?action=delete+29426
http://master.php.net/manage/user-notes.php?action=reject+29426