1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 08:42:13 +01:00
Files
archived-doc-ru/reference/array/functions/array-diff-uassoc.xml
Sergey Panteleev 2c3685336f docs(ru): Updated to English revision
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@351336 c90b9560-bf6c-de11-be94-00142212c4b1
2020-11-09 09:58:27 +00:00

183 lines
5.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 9e0f03ac354d797d1d16c0fcc1663e5e170f2727 Maintainer: shein Status: ready -->
<!-- Reviewed: yes -->
<!-- $Revision$ -->
<refentry xml:id="function.array-diff-uassoc" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_diff_uassoc</refname>
<refpurpose>Вычисляет расхождение массивов с дополнительной проверкой индекса,
осуществляемой при помощи callback-функции
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_diff_uassoc</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
<methodparam><type>callable</type><parameter>key_compare_func</parameter></methodparam>
</methodsynopsis>
<para>
Сравнивает <parameter>array</parameter> c <parameter>arrays</parameter>
и возвращает разницу. В отличие от <function>array_diff</function>,
для сравнения используются ключи.
</para>
<para>
В отличие от <function>array_diff_assoc</function>, для сравнения
ключей используется пользовательская функция, а не встроенная.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>array</parameter></term>
<listitem>
<para>
Исходный массив
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>arrays</parameter></term>
<listitem>
<para>
Массивы, с которыми идет сравнение
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>key_compare_func</parameter></term>
<listitem>
<para>
&return.callbacksort;
</para>
&callback.cmp;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает массив (<type>array</type>), содержащий все элементы
<parameter>array</parameter>, которых нет во всех остальных массивах.
</para>
</refsect1>
<!--
<refsect1 role="errors">
&reftitle.errors;
&errors.no.unusual.errors;
</refsect1>
-->
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>array_diff_uassoc</function></title>
<para>
Пара <literal>"a" =&gt; "green"</literal> существует в обоих
массивах и поэтому отсутствует в выводе функции. Наоборот,
пара <literal>0 =&gt; "red"</literal> находится в выводе функции,
так как второй аргумент <literal>"red"</literal> имеет ключ,
равный <literal>1</literal>.
</para>
<programlisting role="php">
<![CDATA[
<?php
function key_compare_func($a, $b)
{
if ($a === $b) {
return 0;
}
return ($a > $b)? 1:-1;
}
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
$result = array_diff_uassoc($array1, $array2, "key_compare_func");
print_r($result);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[b] => brown
[c] => blue
[0] => red
)
]]>
</screen>
<simpara>
Равенство 2 индексов проверяется функцией, предоставляемой пользователем.
</simpara>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
Эта функция обрабатывает только одно измерение n-размерного массива.
Естественно, вы можете обрабатывать и более глубокие уровни вложенности,
например, используя <literal>array_diff_uassoc($array1[0], $array2[0], "key_compare_func");</literal>.
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>array_diff</function></member>
<member><function>array_diff_assoc</function></member>
<member><function>array_udiff</function></member>
<member><function>array_udiff_assoc</function></member>
<member><function>array_udiff_uassoc</function></member>
<member><function>array_intersect</function></member>
<member><function>array_intersect_assoc</function></member>
<member><function>array_uintersect</function></member>
<member><function>array_uintersect_assoc</function></member>
<member><function>array_uintersect_uassoc</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
-->