PHP Pack/unpack - can it handle variable length strings
I've been trying to figure out if the PHP implementation of Pack/Unpack can do something that the Perl version is able to do. The example I'd like to be able to do in PHP is: http://perldoc.perl.org/perlpacktut.html#String-Lengths # pack a message: ASCIIZ, ASCIIZ, length/string, byte my $msg = pack( 'Z* Z* C/A* C', $src, $dst, $sm, $prio ); # unpack ( $src, $dst, $sm, $prio ) = unpack( 'Z* Z* C/A* C', $msg ); What this Perl code does is described as: Combining two pack codes with a slash (/) associates them with a single value from the argument list. In pack, the length of the argument is