(PECL xdiff >= 0.2.0)
xdiff_file_patch — Patch a file with an unified diff
mixed xdiff_file_patch ( string $file , string $patch , string $dest [, int $flags = DIFF_PATCH_NORMAL ] )
Patches a file with a patch and stores the result in a file. patch has to be an unified diff created by xdiff_file_diff()/xdiff_string_diff() function. An optional flags parameter specifies mode of operation.
Returns FALSE if an internal error happened, string with rejected chunks if patch couldn't be applied or TRUE if patch has been successfully applied.
Exemplo #1 xdiff_file_patch() example
The following code applies unified diff to a file.
Exemplo #2 Patch reversing example
The following code reverses a patch.