public static function binToHex($bin, $length = 0)
    {
        $gmp = gmp_init($bin, 2);
        $hex = gmp_strval($gmp, 16);

        return self::pad($hex, $length);
    }
public static function binToHex($bin, $length = 0)
    {
        $gmp = gmp_init($bin, 2);
        $hex = gmp_strval($gmp, 16);

        return self::pad($hex, $length);
    }
public static function binToHex ( $ bin , $ length = 0 ) { $ gmp = gmp_init ( $ bin , 2 ) ; $ hex = gmp_strval ( $ gmp , 16 ) ; return self :: pad ( $ hex , $ length ) ; }
Converts binary string into hexadecimal string.

@param string $bin    Binary string.
@param int    $length Minimum output length.

@return string Hexadecimal string.
Converts binary string into hexadecimal string .