cvs: phpdoc-ru /reference/array/functions array-intersect-key.xml array-intersect-uassoc.xml array-intersect-ukey.xml

From: Date: Sun, 24 Apr 2005 15:33:50 +0000
Subject: cvs: phpdoc-ru /reference/array/functions array-intersect-key.xml array-intersect-uassoc.xml array-intersect-ukey.xml
Groups: php.doc.ru 
Request: Send a blank email to doc-ru+get-669@lists.php.net to get a copy of this message
sveta Sun Apr 24 11:33:50 2005 EDT Added files: /phpdoc-ru/reference/array/functions array-intersect-key.xml array-intersect-ukey.xml array-intersect-uassoc.xml Log: new translation

http://cvs.php.net/co.php/phpdoc-ru/reference/array/functions/array-intersect-key.xml?r=1.1&p=1 Index: phpdoc-ru/reference/array/functions/array-intersect-key.xml +++ phpdoc-ru/reference/array/functions/array-intersect-key.xml <?xml version="1.0" encoding="utf-8"?> <!-- EN-Revision: 1.2 Maintainer: sveta Status: ready --> <!-- $Revision: 1.1 $ --> <refentry id="function.array-intersect-key"> <refnamediv> <refname>array_intersect_key</refname> <refpurpose>Вычислить пересечение массивов, сравнивая ключи</refpurpose> </refnamediv> <refsect1> <title>Описание</title> <methodsynopsis> <type>array</type><methodname>array_intersect_key</methodname> <methodparam><type>array</type><parameter>array1</parameter></methodparam> <methodparam><type>array</type><parameter>array2</parameter></methodparam> <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> </methodsynopsis> <para> <function>array_intersect_key</function> возвращает массив, содержащий значения <parameter>array1</parameter>, имеющие ключи, содержащиеся во всех последующих параметрах.. </para> <para> <example> <title>Пример использования <function>array_intersect_key</function></title> <programlisting role="php"> <![CDATA[ <?php $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); var_dump(array_intersect_key($array1, $array2)); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["blue"]=> int(1) ["green"]=> int(3) }) ]]> </screen> </example> </para> <para> В нашем примере только ключи <literal>'blue'</literal> и <literal>'green'</literal> содержатся в обоих массивах и поэтому возвращаются. Также обратите внимание, что значения, соответствующие ключам <literal>'blue'</literal> и <literal>'green'</literal> различны в исходных массивах. Совпадение происходит, так как сравниваются только ключи. Возвращаемые значения берутся из <parameter>array1</parameter>. </para> <para> Два ключа пар <literal>key =&gt; value</literal> считаются равными только, если <literal>(string) $key1 === (string) $key2 </literal>. Другими словами, строгая проверка считает, что строковое представление должно быть идентичным. </para> <para> См. также <function>array_diff</function>, <function>array_udiff</function> <function>array_diff_assoc</function>, <function>array_diff_uassoc</function>, <function>array_udiff_assoc</function>, <function>array_udiff_uassoc</function>, <function>array_diff_key</function>, <function>array_diff_ukey</function>, <function>array_intersect</function>, <function>array_intersect_assoc</function>, <function>array_intersect_uassoc</function> и <function>array_intersect_ukey</function>. </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:"../../../../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 --> http://cvs.php.net/co.php/phpdoc-ru/reference/array/functions/array-intersect-ukey.xml?r=1.1&p=1 Index: phpdoc-ru/reference/array/functions/array-intersect-ukey.xml +++ phpdoc-ru/reference/array/functions/array-intersect-ukey.xml <?xml version="1.0" encoding="utf-8"?> <!-- EN-Revision: 1.2 Maintainer: sveta Status: ready --> <!-- $Revision: 1.1 $ --> <refentry id="function.array-intersect-ukey"> <refnamediv> <refname>array_intersect_ukey</refname> <refpurpose>Вычислить пересечение массивов, используя функцию обратного вызова для сравнения ключей</refpurpose> </refnamediv> <refsect1> <title>Описание</title> <methodsynopsis> <type>array</type><methodname>array_intersect_ukey</methodname> <methodparam><type>array</type><parameter>array1</parameter></methodparam> <methodparam><type>array</type><parameter>array2</parameter></methodparam> <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> </methodsynopsis> <para> <function>array_intersect_ukey</function> возвращает массив, содержащий значения <parameter>array1</parameter>, имеющие ключи, содержащиеся во всех последующих параметрах. </para> <para> Для сравнения используется функция, определённая пользователем. Она должна возвращать целое число меньшее, равное или большее нуля, если первый ключ, соответственно, меньше, равен или больше второго. </para> <para> <example> <title>Пример использования <function>array_intersect_ukey</function></title> <programlisting role="php"> <![CDATA[ <?php function key_compare_func($key1, $key2) { if ($key1 == $key2) return 0; else if ($key1 > $key2) return 1; else return -1; } $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func')); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["blue"]=> int(1) ["green"]=> int(3) }) ]]> </screen> </example> </para> <para> В нашем примере только ключи <literal>'blue'</literal> и <literal>'green'</literal> содержатся в обоих массивах и поэтому возвращаются. Также обратите внимание, что значения, соответствующие ключам <literal>'blue'</literal> и <literal>'green'</literal> различны в исходных массивах. Совпадение происходит, так как сравниваются только ключи. Возвращаемые значения берутся из <parameter>array1</parameter>. </para> <para> См. также <function>array_diff</function>, <function>array_udiff</function> <function>array_diff_assoc</function>, <function>array_diff_uassoc</function>, <function>array_udiff_assoc</function>, <function>array_udiff_uassoc</function>, <function>array_diff_key</function>, <function>array_diff_ukey</function>, <function>array_intersect</function>, <function>array_intersect_assoc</function>, <function>array_intersect_uassoc</function> и <function>array_intersect_key</function>. </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:"../../../../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 --> http://cvs.php.net/co.php/phpdoc-ru/reference/array/functions/array-intersect-uassoc.xml?r=1.1&p=1 Index: phpdoc-ru/reference/array/functions/array-intersect-uassoc.xml +++ phpdoc-ru/reference/array/functions/array-intersect-uassoc.xml <?xml version="1.0" encoding="utf-8"?> <!-- EN-Revision: 1.4 Maintainer: sveta Status: ready --> <!-- $Revision: 1.1 $ --> <refentry id="function.array-intersect-uassoc"> <refnamediv> <refname>array_intersect_uassoc</refname> <refpurpose>Вычислить пересечение массивов с дополнительной проверкой индекса, осуществляемой при помощи функции, определённой пользователем</refpurpose> </refnamediv> <refsect1> <title>Описание</title> <methodsynopsis> <type>array</type><methodname>array_intersect_uassoc</methodname> <methodparam><type>array</type><parameter>array1</parameter></methodparam> <methodparam><type>array</type><parameter>array2</parameter></methodparam> <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> </methodsynopsis> <para> <function>array_intersect_uassoc</function> возвращает массив, содержащий значения <parameter>array1</parameter>, содержащиеся во всех последующих параметрах. Обратите внимание, что в отличие от <function>array_intersect</function>, для сравнения используются ключи. </para> <para> Для сравнения используется функция, определённая пользователем. Она должна возвращать целое число меньшее, равное или большее нуля, если первый параметр, соответственно, меньше, равен или больше второго. </para> <para> <example> <title>Пример использования <function>array_intersect_uassoc</function></title> <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red"); print_r(array_intersect_uassoc($array1, $array2, "strcasecmp")); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Array ( [b] => brown ) ]]> </screen> </example> </para> <para> См. также <function>array_intersect</function>, <function>array_intersect_assoc</function>, <function>array_uintersect_assoc</function>, <function>array_uintersect_uassoc</function>, <function>array_intersect_key</function> и <function>array_intersect_ukey</function>. </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:"../../../../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 -->
« previous php.doc.ru (#669) next »