title: PHP Pack/unpack - can it handle variable length strings
body: <p>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:</p>
  
  <p><a href="http://perldoc.perl.org/perlpacktut.html#String-Lengths" rel="nofollow">http://perldoc.perl.org/perlpacktut.html#String-Lengths</a></p>
  
  <pre><code># 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 );
  </code></pre>
  
  <p>What this Perl code does is described as:</p>
  
  <blockquote>
    <p>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 taken and packed according to the first code while the
    argument itself is added after being converted with the template code
    after the slash.</p>
  </blockquote>
  
  <p>i.e. you can pack variable length strings and then unpack them in one step, rather than having to figure out the length of the string first and then extracting it as a separate step.</p>
  
  <p>The PHP manual doesn't mention this capability and any attempt to insert a pattern like 'C/A*' into unpack is giving errors for me. Is that an oversight in the manual or just something that the PHP version doesn't support?</p>