downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.xdiff-file-bdiff.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-bdiff.php',
   
1 => 'xdiff_file_bdiff',
  ),
 
'up' =>
  array (
   
0 => 'ref.xdiff.php',
   
1 => 'xdiff Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.xdiff-file-bdiff-size.php',
   
1 => 'xdiff_file_bdiff_size',
  ),
 
'next' =>
  array (
   
0 => 'function.xdiff-file-bpatch.php',
   
1 => 'xdiff_file_bpatch',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.xdiff-file-bdiff" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xdiff_file_bdiff</h1>
  <p class="verinfo">(PECL xdiff &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">xdiff_file_bdiff</span> &mdash; <span class="dc-title">Make binary diff of two files</span></p>

 </div>
 
 <a name="function.xdiff-file-bdiff.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>xdiff_file_bdiff</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_file</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$dest</tt></span>
   )</div>

  <p class="para rdfs-comment">
   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 <a href="function.xdiff-file-bpatch.php" class="function">xdiff_file_bpatch()</a>/<a href="function.xdiff-string-bpatch.php" class="function">xdiff_string_bpatch()</a>.
  </p>
 </div>


 <a name="function.xdiff-file-bdiff.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. This file acts as &quot;old&quot; file.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">new_file</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Path to the second file. This file acts as &quot;new&quot; file.
      </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 patch file. Resulting file contains differences
       between &quot;old&quot; and &quot;new&quot; files. It is in binary format and is human-unreadable.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.xdiff-file-bdiff.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
  </p>
 </div>


 <a name="function.xdiff-file-bdiff.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_bdiff()</b> example</b></p>
    <div class="example-contents para"><p>
     The following code makes binary diff of two archives.
    </p></div>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$old_version&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'my_script_1.0.tgz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$new_version&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'my_script_1.1.tgz'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">xdiff_file_bdiff</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$new_version</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'my_script.bdiff'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.xdiff-file-bdiff.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>:
  
    Both files will be loaded into memory so ensure that your memory_limit is
    set high enough.
   <br />
  </p></blockquote>
 </div>


 <a name="function.xdiff-file-bdiff.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-file-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_file_bpatch()</a> - Patch a file with a binary diff</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites