mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
144 lines
4.3 KiB
XML
144 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 4754397753fd79f1c846868b66a2448babab1c54 Maintainer: leonardolara Status: ready --><!-- CREDITS: leonardolara -->
|
|
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
|
|
<refentry xml:id="function.xdiff-string-diff" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>xdiff_string_diff</refname>
|
|
<refpurpose>Faz uma diferença unificada entre duas strings</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>xdiff_string_diff</methodname>
|
|
<methodparam><type>string</type><parameter>old_data</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>new_data</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>context</parameter><initializer>3</initializer></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>minimal</parameter><initializer>&false;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Cria uma diferença unificada contendo as diferenças entre a string <parameter>old_data</parameter> e a string
|
|
<parameter>new_data</parameter> e o retorna. A diferença resultante é legível por humanos.
|
|
Um parâmetro opcional <parameter>context</parameter> especifica quantas linhas de contexto devem ser
|
|
adicionadas em torno de cada alteração. Definir o parâmetro <parameter>minimal</parameter>
|
|
como verdadeiro resultará na saída do menor arquivo de patch possível (pode levar muito tempo).
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>old_data</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Primeira sequência com dados. Atua como dados "antigos".
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>new_data</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Segunda sequência com dados. Atua como dados "novos".
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>context</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Indica quantas linhas de contexto você deseja incluir no resultado
|
|
da diferença.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>minimal</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Defina este parâmetro como &true; se quiser minimizar o tamanho do
|
|
resultado (pode levar muito tempo).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retorna uma string com a diferença resultante ou &false; se ocorrer um erro interno.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>xdiff_string_diff</function></title>
|
|
<para>
|
|
O código a seguir faz uma comparação unificada de dois artigos.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$old_article = file_get_contents('./old_article.txt');
|
|
$new_article = $_REQUEST['article']; /* Digamos que alguém colou um novo artigo em um formato HTML */
|
|
|
|
$diff = xdiff_string_diff($old_article, $new_article, 1);
|
|
if (is_string($diff)) {
|
|
echo "Diferenças entre dois artigos:\n";
|
|
echo $diff;
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Esta função não funciona bem com strings binárias. Para obter diferenças de strings
|
|
binárias, use <function>xdiff_string_bdiff</function>/<function>xdiff_string_rabdiff</function>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>xdiff_string_patch</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|