pack/unpack in PHP
Joe Stump
joe at digg.com
Fri Oct 12 22:53:17 UTC 2007
I just answered my own question and it's pretty retarded:
$arr = unpack("a4magic/Ntype/Nlen", $header);
So, evidently, the syntax isn't *quite* like the Perl syntax :)
--Joe
On Oct 12, 2007, at 3:41 PM, Joe Stump wrote:
> I'm working on a PHP library for us to use here at Digg and was
> hoping someone could help me out with some of the basics. I can
> pack up and send a request over no problemo and I get a response,
> but unpacking with:
>
> $header = fread($fp, 12);
> $arr = unpack("a4NN", $header);
>
> Doesn't quite work (PHP uses the same pack/unpack as Perl so I'm
> running off of that example). The response I get, according to bvi
> anyways, appears to be valid in that I get a null byte, RES, 0, 0,
> 0, 17, 0, 0, 0, 10 (I'm sending 'helloworld', which is 10 bytes).
>
> The $arr is:
>
> Array
> (
> [NN] => RES
> )
>
> Any ideas?
>
> Thanks!
>
> --Joe
>
> _______________________________________________
> Gearman mailing list
> Gearman at lists.danga.com
> http://lists.danga.com/mailman/listinfo/gearman
More information about the Gearman
mailing list