When saving revision #7
of a textfile with PHP, I use:
<?php
$file = fopen("data/myfile-revision7", 'w');
fwrite($file, $data);
fclose($file);
?>
But instead of saving the whole $data
again and again for every revision, I would prefer to store the differences between myfile-revision1
and myfile-revision7
.
Is there a function included in PHP that would compute the diff of 2 text files?
Note: If later, I want to get the full myfile-revision7
textfile again, how can I generate this file back, with the diff data?