note 86123 added to function.bin2hex

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Because the way back (hex2bin) doesn't exist on php, i've written another little function without using commands like pack:

<?php
// Convert a hex-string to binary-string (the way back from bin2hex)

function hex2bin($h)
  {
  if (!is_string($h)) return null;
  $r='';
  for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
  return $r;
  }

echo bin2hex('Hello'); // result: 48656c6c6f
echo hex2bin('48656c6c6f'); // result: Hello
?>
----
Server IP: 217.13.201.10
Probable Submitter: 89.56.25.218
----
Manual Page -- http://www.php.net/manual/en/function.bin2hex.php
Edit        -- https://master.php.net/note/edit/86123
Del: integrated  -- https://master.php.net/note/delete/86123/integrated
Del: useless     -- https://master.php.net/note/delete/86123/useless
Del: bad code    -- https://master.php.net/note/delete/86123/bad+code
Del: spam        -- https://master.php.net/note/delete/86123/spam
Del: non-english -- https://master.php.net/note/delete/86123/non-english
Del: in docs     -- https://master.php.net/note/delete/86123/in+docs
Del: other reasons-- https://master.php.net/note/delete/86123
Reject      -- https://master.php.net/note/reject/86123
Search      -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.