<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = 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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.xdiff-string-rabdiff.php',
    1 => 'xdiff_string_rabdiff',
    2 => 'Make a binary diff of two strings using the Rabin\'s polynomial fingerprinting algorithm',
  ),
  'up' => 
  array (
    0 => 'ref.xdiff.php',
    1 => 'xdiff Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.xdiff-string-patch-binary.php',
    1 => 'xdiff_string_patch_binary',
  ),
  'next' => 
  array (
    0 => 'refs.international.php',
    1 => 'Supporto al linguaggio umano e condifica caratteri',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xdiff/functions/xdiff-string-rabdiff.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.xdiff-string-rabdiff" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xdiff_string_rabdiff</h1>
  <p class="verinfo">(PECL xdiff &gt;= 1.5.0)</p><p class="refpurpose"><span class="refname">xdiff_string_rabdiff</span> &mdash; <span class="dc-title">
   Make a binary diff of two strings using the Rabin&#039;s polynomial fingerprinting algorithm
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.xdiff-string-rabdiff-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>xdiff_string_rabdiff</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$old_data</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$new_data</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Makes a binary diff of two strings using the Rabin&#039;s polynomial fingerprinting algorithm implemented by
   <a href="http://www.xmailserver.org/xdiff-lib.html" class="link external">&raquo;&nbsp;libxdiff</a>. Compared to
   <span class="function"><a href="function.xdiff-string-bdiff.php" class="function">xdiff_string_bdiff()</a></span>, this algorithm generally produces smaller diffs and operates faster,
   while remaining fully compatible with <span class="function"><a href="function.xdiff-string-bpatch.php" class="function">xdiff_string_bpatch()</a></span> and
   <span class="function"><a href="function.xdiff-file-bpatch.php" class="function">xdiff_file_bpatch()</a></span> for applying patches.
  </p>
  <p class="para">
   This function can be used with both text and binary data. The resulting diff data can later be
   applied to recreate the new version from the old one.
  </p>
  <p class="para">
   For further information about the algorithm, see the
   <a href="https://www.xmailserver.org/xdiff-lib.html" class="link external">&raquo;&nbsp;libxdiff documentation</a>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xdiff-string-rabdiff-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">old_data</code></dt>
     <dd>
      <p class="para">
       The first string containing the &quot;old&quot; binary data.
      </p>
     </dd>
    
    
     <dt><code class="parameter">new_data</code></dt>
     <dd>
      <p class="para">
       The second string containing the &quot;new&quot; binary data.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xdiff-string-rabdiff-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns a binary diff string containing the differences between the old and new data, o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.xdiff-string-rabdiff-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Creation of a binary diff between two strings</strong></p>
    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$old </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'file_v1.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$new </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'file_v2.txt'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$diff </span><span style="color: #007700">= </span><span style="color: #0000BB">xdiff_string_rabdiff</span><span style="color: #007700">(</span><span style="color: #0000BB">$old</span><span style="color: #007700">, </span><span style="color: #0000BB">$new</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'patch.rdiff'</span><span style="color: #007700">, </span><span style="color: #0000BB">$diff</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-function.xdiff-string-rabdiff-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.xdiff-string-bdiff.php" class="function" rel="rdfs-seeAlso">xdiff_string_bdiff()</a> - Make binary diff of two strings</span></li>
    <li><span class="function"><a href="function.xdiff-string-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_string_bpatch()</a> - Patch a string with a binary diff</span></li>
    <li><span class="function"><a href="function.xdiff-file-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_file_bpatch()</a> - Patch a file with a binary diff</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>