XDIFF_FILE_DIFF(3) 1 XDIFF_FILE_DIFF(3)xdiff_file_diff - Make unified diff of two filesSYNOPSIS
bool xdiff_file_diff (string $old_file, string $new_file, string $dest, [int $context = 3], [bool $minimal = false])
DESCRIPTION
Makes an unified diff containing differences between $old_file and $new_file and stores it in $dest file. The resulting file is human-
readable. An optional $context parameter specifies how many lines of context should be added around each change. Setting $minimal parameter
to true will result in outputting the shortest patch file possible (can take a long time).
PARAMETERS
o $old_file
- Path to the first file. This file acts as "old" file.
o $new_file
- Path to the second file. This file acts as "new" file.
o $dest
- Path of the resulting patch file.
o $context
- Indicates how many lines of context you want to include in diff result.
o $minimal
- Set this parameter to TRUE if you want to minimalize size of the result (can take a long time).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
xdiff_file_diff(3) example
The following code makes unified diff of two php files with context length of 2.
<?php
$old_version = 'my_script.php';
$new_version = 'my_new_script.php';
xdiff_file_diff($old_version, $new_version, 'my_script.diff', 2);
?>
NOTES
Note
This function doesn't work well with binary files. To make diff of binary files use xdiff_file_bdiff(3)/xdiff_file_rabdiff(3) func-
tion.
SEE ALSO xdiff_file_patch(3).
PHP Documentation Group XDIFF_FILE_DIFF(3)
Check Out this Related Man Page
XDIFF_FILE_DIFF_BINARY(3) 1 XDIFF_FILE_DIFF_BINARY(3)xdiff_file_diff_binary - Alias of xdiff_file_bdiffSYNOPSIS
bool xdiff_file_diff_binary (string $old_file, string $new_file, string $dest)
DESCRIPTION
Makes a binary diff of two files and stores the result in a patch file. This function works with both text and binary files. Resulting
patch file can be later applied using xdiff_file_bpatch(3).
Starting with version 1.5.0 this function is an alias of xdiff_file_bdiff(3).
PARAMETERS
o $old_file
- Path to the first file. This file acts as "old" file.
o $new_file
- Path to the second file. This file acts as "new" file.
o $dest
- Path of the resulting patch file. Resulting file contains differences between "old" and "new" files. It is in binary format and
is human-unreadable.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
xdiff_file_diff_binary(3) example
The following code makes binary diff of two archives.
<?php
$old_version = 'my_script_1.0.tgz';
$new_version = 'my_script_1.1.tgz';
xdiff_file_diff_binary($old_version, $new_version, 'my_script.bdiff');
?>
NOTES
Note
Both files will be loaded into memory so ensure that your memory_limit is set high enough.
SEE ALSO xdiff_file_bdiff(3), xdiff_file_bpatch(3).
PHP Documentation Group XDIFF_FILE_DIFF_BINARY(3)
I want to execute a shell script without ./ symbol.
For example:
./my_script ===== my_script (both of them can execute my script)
both of them are the same as result. (2 Replies)
Hi,
I am trying to update a MASTER file by a NEW file which may contain fewer records.
The update should use a key (2 first fields), here is a senario:
MASTER:
a;b;0
a;c;0
a;d;0
NEW:
a;c;1
the result should be:
a;b;0
a;c;1
a;d;0
can you recommend me a way to do it?
10x
Y.N. (25 Replies)
I have a applicaton , when run /tmp/my_script , that will output the result to the screen ( as below ) , the output is very long ( about 1500 lines ) , I have a program ( as below ) that will show the output with function 1 > 1 , it works fine , however , the output only show page 1 of this 1500... (5 Replies)
i'm trying to parse a file with lines like the below where i need to get a diff on the 169-182 so that the result is 13 for instance. I was looking into using bc but am not that familiar with embedding it in a script.
john8:9. 169-182
any ideas are appreciated! (5 Replies)
Hi,
I would like to perform a loop through the passing in argument, is there any method.
I.e
command> my_script a b c d
my_script
----------
for i in $#
echo $i
done (3 Replies)
Why do I see ^M in vi with php files? I don't see that in any other type of files.
I added this to my .bashrc and it went away. Does anyone know why this is happening? What does exporting xterm-color do that makes it go away?
export TERM="xterm-color" (8 Replies)