I've read and tried every answer here, 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:
[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
xdiff
works fine for creating bdiff patches and patching file - I'm looking too illustrate the differences.
$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;
}
Maybe xdiff
isn't the right extension to be using for this? I'm not sure.