php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64252 add to documentation
Submitted: 2013-02-20 16:14 UTC Modified: 2013-02-27 04:41 UTC
From: ray at gurganus dot org Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.21 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ray at gurganus dot org
New email:
PHP Version: OS:

 

 [2013-02-20 16:14 UTC] ray at gurganus dot org
Description:
------------
The documentation on the pack() function could be a little clearer.  I needed a function that would receive a hex string and output binary for creating an image.  The first time I read the documentation page, I had no idea this is the answer I was looking for, and eventually found it in someone else's code.

Here's the code I have that returns the output I needed.

$GIF = "CCFFCC009900...." (etc)
$output = pack("H".strlen($GIF),$GIF);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-27 04:41 UTC] frozenfire@php.net
pack is one of those functions which really is fairly necessarily complicated and 
hard to document. I don't think there's anything we could add to the 
documentation that could possibly clear things up. I've used pack and unpack 
extensively, and I feel your pain, but unless you have a suggestion, I don't 
think there's a solution.

As for your example, I think the documentation is actually pretty clear about how 
to pack a hex string.
 [2013-02-27 04:41 UTC] frozenfire@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC