title: Return hexidecimal differences in binary files with PHP
body: <p>I've read and tried every answer <a href="https://stackoverflow.com/questions/321294/highlight-the-difference-between-two-strings-in-php">here</a>, yet they seem to only apply to strings in non-binary formats. I'm trying to compare differences in binary files and return those in format such as this:</p>
  
  <pre><code>[file1]
  
  -0001010: ac 0f 00 00 01 00 00 00 48 65 6c 6c 6f 2c 20 77  ........Hello, w
  
  [file2]
  
  +0001010: ac 0f 00 00 01 00 00 00 48 75 6c 6c 6f 2c 20 77  ........Hullo, w
  </code></pre>
  
  <p><code>xdiff</code> works fine for creating bdiff patches and patching file - I'm looking too illustrate the differences.</p>
  
  <pre><code>$one = 'one'; // original file
  $two = 'two'; // updated file
  $pat = 'dif'; // bdiff patch
  $new = 'new'; // new destfile
  
  xdiff_file_diff_binary($one, $two, $pat);
  xdiff_file_patch_binary($one, $pat, $new);
  
  $diff = xdiff_file_diff($one, $two, 1);
  if (is_file($diff)) {
      echo "Differences:\n"; // result = 1 
      echo $diff;
  }
  </code></pre>
  
  <p>Maybe <code>xdiff</code> isn't the right extension to be using for this? I'm not sure.</p>