Source of: /manual/en/function.xdiff-file-merge3.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xdiff.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.xdiff-file-merge3.php',
1 => 'xdiff_file_merge3',
),
'up' =>
array (
0 => 'ref.xdiff.php',
1 => 'xdiff Functions',
),
'prev' =>
array (
0 => 'function.xdiff-file-diff.php',
1 => 'xdiff_file_diff',
),
'next' =>
array (
0 => 'function.xdiff-file-patch-binary.php',
1 => 'xdiff_file_patch_binary',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.xdiff-file-merge3" class="refentry">
<div class="refnamediv">
<h1 class="refname">xdiff_file_merge3</h1>
<p class="verinfo">(PECL xdiff >= 0.2.0)</p><p class="refpurpose"><span class="refname">xdiff_file_merge3</span> — <span class="dc-title">Merge 3 files into one</span></p>
</div>
<a name="function.xdiff-file-merge3.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b>xdiff_file_merge3</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$old_file</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$new_file1</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$new_file2</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$dest</tt></span>
)</div>
<p class="para rdfs-comment">
Merges three files into one and stores the result in a file <i><tt class="parameter">dest</tt></i>
.
The <i><tt class="parameter">old_file</tt></i>
is an original version while <i><tt class="parameter">new_file1</tt></i>
and <i><tt class="parameter">new_file2</tt></i>
are modified versions of an original.
</p>
</div>
<a name="function.xdiff-file-merge3.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">old_file</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path to the first file. It acts as "old" file.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">new_file1</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path to the second file. It acts as modified version of <i><tt class="parameter">old_file</tt></i>
.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">new_file2</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path to the third file. It acts as modified version of <i><tt class="parameter">old_file</tt></i>
.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">dest</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Path of the resulting file, containing merged changed from both <i><tt class="parameter">new_file1</tt></i>
and
<i><tt class="parameter">new_file2</tt></i>
.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.xdiff-file-merge3.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> if merge was successful, string with rejected chunks if
it was not or <b><tt class="constant">FALSE</tt></b> if an internal error happened.
</p>
</div>
<a name="function.xdiff-file-merge3.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>xdiff_file_merge3()</b> example</b></p>
<div class="example-contents para"><p>
The following code merges three files into one.
</p></div>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />$old_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'original_script.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$fix1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'script_with_fix1.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$fix2 </span><span style="color: #007700">= </span><span style="color: #DD0000">'script_with_fix2.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$errors </span><span style="color: #007700">= </span><span style="color: #0000BB">xdiff_file_merge3</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">, </span><span style="color: #0000BB">$fix1</span><span style="color: #007700">, </span><span style="color: #0000BB">$fix2</span><span style="color: #007700">, </span><span style="color: #DD0000">'fixed_script.php'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">is_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$errors</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Rejects:\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #0000BB">$errors</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.xdiff-file-merge3.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.xdiff-string-merge3.php" class="function" rel="rdfs-seeAlso">xdiff_string_merge3()</a> - Merge 3 strings into one</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>