title: Writing Binary Data from Hex String in PHP
body: <p>I'm trying to write a binary file from hex string.
  For example, if my hex string is <code>C27EF0EC</code>, then the hex file should contain <strong>ASCII</strong> characters for <code>C2</code>, <code>7E</code>, <code>F0</code> and <code>EC</code>.<br />
  How do I do this in <code>PHP</code>?</p>
  
  <p>Here's what I've tried:</p>
  
  <pre><code>$s="";
  for ($i=0; $i&lt;count($h); $i++) {
      $s+=pack("C*", "0x".$h[$i]);
  }
  $f2=fopen("codes0", "wb+");
  fwrite($f2, $s);
  </code></pre>