php man page for xdiff_string_diff

Query: xdiff_string_diff

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

XDIFF_STRING_DIFF(3)							 1						      XDIFF_STRING_DIFF(3)

xdiff_string_diff - Make unified diff of two strings

SYNOPSIS
string xdiff_string_diff (string $old_data, string $new_data, [int $context = 3], [bool $minimal = false])
DESCRIPTION
Makes an unified diff containing differences between $old_data string and $new_data string and returns it. The resulting diff 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_data - First string with data. It acts as "old" data. o $new_data - Second string with data. It acts as "new" data. o $context - Indicates how many lines of context you want to include in the diff result. o $minimal - Set this parameter to TRUE if you want to minimalize the size of the result (can take a long time).
RETURN VALUES
Returns string with resulting diff or FALSE if an internal error happened.
EXAMPLES
Example #1 xdiff_string_diff(3) example The following code makes unified diff of two articles. <?php $old_article = file_get_contents('./old_article.txt'); $new_article = $_REQUEST['article']; /* Let's say that someone pasted a new article to html form */ $diff = xdiff_string_diff($old_article, $new_article, 1); if (is_string($diff)) { echo "Differences between two articles: "; echo $diff; } ?>
NOTES
Note This function doesn't work well with binary strings. To make diff of binary strings use xdiff_string_bdiff(3)/xdiff_string_rabd- iff(3).
SEE ALSO
xdiff_string_patch(3). PHP Documentation Group XDIFF_STRING_DIFF(3)
Related Man Pages
cut-diff(1) - debian
oggz-diff(1) - debian
xdiff_file_bdiff(3) - php
xdiff_file_diff_binary(3) - php
xdiff_string_bdiff_size(3) - php
Similar Topics in the Unix Linux Community
Need help with Scripting diff command
urlwatch 1.0 (Default branch)
urlwatch 1.2 (Default branch)
urlwatch 1.3 (Default branch)
Padding diff result