title: PHP Warning: pack(): Type H: illegal hex digit r error
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/4732681/pack-in-php-illegal-hex-digit-warning">pack() in php. Illegal hex digit warning</a></p>
  </blockquote>
  
  <p>I am utilizing apple's push notification service and in order to send the notification, you have to build the message in binary. I got the following errors for the line below:</p>
  <blockquote>
  <p>Warning: pack(): Type H: illegal hex digit r</p>
  <p>Warning: pack(): Type H: illegal hex digit y</p>
  <p>Notice: Array to string conversion in C:\xampp\htdocs\firecom\FireComAPNS.php on line 130</p>
  </blockquote>
  <p>Here's the line of code throwing the error:</p>
  <pre><code>$msg = chr(0).pack('n', 32).pack('H*', $devicetoken).pack('n',strlen($payload)) . $payload;
  </code></pre>
  <p>and</p>
  <pre><code>$devicetoken=773f5436825a7115417d3d1e036da20e806efeef547b7c3fe4da724d97c01b30
  </code></pre>
  <p>I have searched on the internet a lot, but I have no idea how to mess with binary, any help on what's going on would be greatly appreciated!</p>