title: PHP unpack question
body: <pre><code>list(,$nfields) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
  </code></pre>
  
  <p>The question is, why <code>"N*"</code> if <code>substr</code> should return 4 bytes, and they will be unpacked as N? And why double assignment?</p>
  
  <p><strong>UPD</strong>: This code is part of <a href="http://sphinxsearch.com/" rel="nofollow noreferrer">Sphinx</a> native PHP connector. After some code hacking it became clear that this code extracts 4-byte integer. But logic behind double assignment and <code>substr</code> / <code>N*</code> is still unclear to me. I'm offering a bounty to finally understand it.</p>