Home  >  Q&A  >  body text

Garbled characters occur when using pack()

$str="31C5231BC21E055A854C76E5B5C5ABBBC412801280D59CEC736C27DB8376876575547DB29C67432D28BC38EA3BF506465310569F700C9E5B205D3E580EE3A2EA4 EFF53695BE49499D36CF9F30FFA704EBA08617A18BBF978A8853837F1A92C85DBF113BD99E4DD4670C5FA85A98CA0BDA21C4B7B4B3CD19DBA9B338932C426F0ECBD0ACF17273CAA4 364B25A4D72BAC02CD9030BB3A4C7FA75925356397AFD06AED83C887A8C4ACC9DEFDD5B9562D37D2CC0AA34E2D79F07A3461EBC2E0D9153530928954FBAB99516860D406E274 A74D723AA98B1A25850132F0692D17C4A88D67E1C1B14C552BCB9040FEBA1AD160B99FB4F8829B5C5CB1CABFFA60193945C";

$n = strlen($str);
$sbin="";
$i=0;
while($i< $ n)
{
$ A = Substr ($ Str, $ i, 2);
$ C = Pack ("h*", $ a); if ($ i == 0) { $sbin=$c;}
            else {$sbin.=$c;}
                        $i =2;}
              ’s ’ ’ s ’ s ‐       ‐         ‐   ‐ ‐ ‐ ‐                               ‐           ‐ ‐                                             through   through ’ ’ through ’ through ’ using ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ ‐ else ‐ {$sbin.=$c;}
                               $a) means to convert hexadecimal to binary

emmmmmmemmmmmm1848 days ago2152

reply all(1)I'll reply

  • 秋香姐家的小书童

    秋香姐家的小书童2019-06-25 14:45:12

    Definition and usage

    pack() function loads data into a binary string.

    Syntax

    pack(format,args+)

    ##Parameters

    Description

    format Required. Specifies the format used when packaging data.

    args+ Optional. Specifies one or more parameters to be wrapped.


    reply
    0
  • Cancelreply