<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.xdiff-string-rabdiff.php',
    1 => 'xdiff_string_rabdiff',
    2 => 'Cr&eacute;e un diff binaire de 2 cha&icirc;nes en utilisant l\'algorithme polynomial de Rabin des empreintes digitales',
  ),
  'up' => 
  array (
    0 => 'ref.xdiff.php',
    1 => 'Fonctions xdiff',
  ),
  'prev' => 
  array (
    0 => 'function.xdiff-string-patch-binary.php',
    1 => 'xdiff_string_patch_binary',
  ),
  'next' => 
  array (
    0 => 'refs.international.php',
    1 => 'Support du langage humain et de l\'encodage de caract&egrave;res',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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">
   Crée un diff binaire de 2 chaînes en utilisant l&#039;algorithme polynomial de Rabin des empreintes digitales
  </span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.xdiff-string-rabdiff-description">
  <h3 class="title">Description</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">

   Crée un diff binaire entre deux chaînes en utilisant l’algorithme d’empreinte polynomial de Rabin implémenté par
   <a href="http://www.xmailserver.org/xdiff-lib.html" class="link external">&raquo;&nbsp;libxdiff</a>. Comparé à
   <span class="function"><a href="function.xdiff-string-bdiff.php" class="function">xdiff_string_bdiff()</a></span>, cet algorithme génère généralement des diffs plus compacts et fonctionne plus rapidement,
   tout en restant pleinement compatible avec <span class="function"><a href="function.xdiff-string-bpatch.php" class="function">xdiff_string_bpatch()</a></span> et
   <span class="function"><a href="function.xdiff-file-bpatch.php" class="function">xdiff_file_bpatch()</a></span> pour l’application des patchs.
  </p>
  <p class="para">
   Cette fonction peut être utilisée avec des données texte ou binaires. Les données de diff produites peuvent ensuite être
   appliquées afin de recréer la nouvelle version à partir de l’ancienne.
  </p>
  <p class="para">
   Pour obtenir davantage d’informations sur l’algorithme, consulter la
   <a href="https://www.xmailserver.org/xdiff-lib.html" class="link external">&raquo;&nbsp;documentation de libxdiff</a>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xdiff-string-rabdiff-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">old_data</code></dt>
     <dd>
      <p class="para">
       La première chaîne contenant les données binaires « anciennes ».
      </p>
     </dd>
    
    
     <dt><code class="parameter">new_data</code></dt>
     <dd>
      <p class="para">
       La seconde chaîne contenant les données binaires « nouvelles ».
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xdiff-string-rabdiff-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une chaîne binaire contenant les différences entre les données anciennes et nouvelles, ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.xdiff-string-rabdiff-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Création d’un diff binaire entre deux chaînes</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">Voir aussi</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> - Cr&eacute;e un diff binaire de 2 cha&icirc;nes</span></li>
    <li><span class="function"><a href="function.xdiff-string-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_string_bpatch()</a> - Patche une cha&icirc;ne avec un diff binaire</span></li>
    <li><span class="function"><a href="function.xdiff-file-bpatch.php" class="function" rel="rdfs-seeAlso">xdiff_file_bpatch()</a> - Patche un fichier avec un diff binaire</span></li>
   </ul>
  </p>
 </div>


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