Zend - The PHP Company




Algorithms

Add Code


Integer to IP string  

Type: code fragment
Added by: kirill
Entered: 03/03/2000
Last modified: 08/12/1999
Rating: *** (3 votes)
Views: 9459
Convert integer to IP (XXX.YYY.WWW.ZZZ)string


<?php
function inttostr($ip) {
    
$str "";
    for (
$i 0$i 4$i++) {
        if (
$i$str "." $str;
        
$str = ($ip 0x000000FF) . $str;
        
$ip $ip >> 8;
    };
    return 
$str;
};

?>


Usage Example




Rate This Script





Search



This Category All Categories