lib/ezutils/classes/ezdebug.php
private static function packedToBin( $packedIPAddress )
     {
        $binaryIPAddress = '';

        // In PHP v5.5 (and up) the unpack function's returned value formats behavior differs
        if ( version_compare( PHP_VERSION, '5.5.0-dev', '>=' ) )
        {
            // Turns the space padded string into an array of the unpacked in_addr representation
            // In PHP v5.5 format 'a' retains trailing null bytes
            $unpackedIPAddress = unpack( 'a16', $packedIPAddress );
        }
        else
        {
            // Turns the space padded string into an array of the unpacked in_addr representation
            // In PHP v5.4 <= format 'A' retains trailing null bytes
            $unpackedIPAddress = unpack( 'A16', $packedIPAddress );
        }
        $unpackedIPAddressArray = str_split( $unpackedIPAddress[1] );

        // Get each characters ascii number, then turn that number into a binary
        // and pad it with 0's to the left if it isn't 8 digits long
        foreach( $unpackedIPAddressArray as $character )
        {
            $binaryIPAddress .= str_pad( decbin( ord( $character ) ), 8, '0', STR_PAD_LEFT );
        }

        return $binaryIPAddress;
     }
private static function packedToBin( $packedIPAddress )
     {
        $binaryIPAddress = '';

        // In PHP v5.5 (and up) the unpack function's returned value formats behavior differs
        if ( version_compare( PHP_VERSION, '5.5.0-dev', '>=' ) )
        {
            // Turns the space padded string into an array of the unpacked in_addr representation
            // In PHP v5.5 format 'a' retains trailing null bytes
            $unpackedIPAddress = unpack( 'a16', $packedIPAddress );
        }
        else
        {
            // Turns the space padded string into an array of the unpacked in_addr representation
            // In PHP v5.4 <= format 'A' retains trailing null bytes
            $unpackedIPAddress = unpack( 'A16', $packedIPAddress );
        }
        $unpackedIPAddressArray = str_split( $unpackedIPAddress[1] );

        // Get each characters ascii number, then turn that number into a binary
        // and pad it with 0's to the left if it isn't 8 digits long
        foreach( $unpackedIPAddressArray as $character )
        {
            $binaryIPAddress .= str_pad( decbin( ord( $character ) ), 8, '0', STR_PAD_LEFT );
        }

        return $binaryIPAddress;
     }
private static function packedToBin ( $ packedIPAddress ) { $ binaryIPAddress = '' ; // In PHP v5.5 (and up) the unpack function's returned value formats behavior differs if ( version_compare ( PHP_VERSION , '5.5.0-dev' , '>=' ) ) { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.5 format 'a' retains trailing null bytes $ unpackedIPAddress = unpack ( 'a16' , $ packedIPAddress ) ; } else { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.4 <= format 'A' retains trailing null bytes $ unpackedIPAddress = unpack ( 'A16' , $ packedIPAddress ) ; } $ unpackedIPAddressArray = str_split ( $ unpackedIPAddress [ 1 ] ) ; // Get each characters ascii number, then turn that number into a binary // and pad it with 0's to the left if it isn't 8 digits long foreach ( $ unpackedIPAddressArray as $ character ) { $ binaryIPAddress .= str_pad ( decbin ( ord ( $ character ) ) , 8 , '0' , STR_PAD_LEFT ) ; } return $ binaryIPAddress ; }
Turns the 'packed' output of inet_pton into a full binary representation

@param string $packedIPAddress Packed ip address in binary string form
@return string Returns binary string representation
Turns the packed output of inet_pton into a full binary representation