mirror of
https://github.com/php/doc-pl.git
synced 2026-03-24 07:02:07 +01:00
154 lines
4.5 KiB
XML
Executable File
154 lines
4.5 KiB
XML
Executable File
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c84024092aee02b51dd18b909af0f2ccbdd24f98 Maintainer: leszek Status: ready -->
|
|
<!-- $Revision$ -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.array-intersect-assoc">
|
|
<refnamediv>
|
|
<refname>array_intersect_assoc</refname>
|
|
<refpurpose>Wylicza przecięcie tablic z dodatkowym sprawdzaniem indeksów</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_intersect_assoc</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
<function>array_intersect_assoc</function> zwraca tablicę
|
|
zawierającą wszystkie wartości tablicy <parameter>array</parameter>,
|
|
które istnieją we wszystkich argumentach. Zauważ, że w przeciwieństwie
|
|
do <function>array_intersect</function>, w porównaniu brane są uwagę też klucze.
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Główna tablica z wartościami do sprawdzenia.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>arrays</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Tablice, które porównujemy.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Zwraca tablicę zawierającą wszystkie wartości
|
|
tablicy <parameter>array</parameter>, które istnieją we wszystkich przekazanych do funkcji tablicach.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&array.changelog.require-only-one;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Przykład użycia <function>array_intersect_assoc</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = array("a" => "zielony", "b" => "brązowy", "c" => "niebieski", "czerwony");
|
|
$array2 = array("a" => "zielony", "b" => "żółty", "niebieski", "czerwony");
|
|
$result_array = array_intersect_assoc($array1, $array2);
|
|
print_r($result_array);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[a] => zielony
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
W naszym przykładzie widzimy, że tylko para <literal>"a" =>
|
|
"zielony"</literal> występuje w obu tablicach, a więc jest zwracana.
|
|
Element <literal>"czerwony"</literal> nie jest zwracany, gdyż w tablicy
|
|
<varname>$array1</varname> jego klucz to <literal>0</literal>, a
|
|
kluczem elementu "czerwony" w tablicy <varname>$array2</varname> jest
|
|
<literal>1</literal>. Z kolei klucz <literal>"b"</literal> nie jest zwracany,
|
|
ponieważ jego wartośi są różne w obu tablicach.
|
|
</simpara>
|
|
<simpara>
|
|
Dwie wartości z par <literal>klucz => wartość</literal> są
|
|
uznawane za równe wtedy i tylko wtedy, gdy
|
|
<literal>(string) $elem1 === (string) $elem2 </literal>. Innymi słowy,
|
|
wykonywane jest ścisłe sprawdzenie typów, więc ich reprezentacje jako
|
|
tekst muszą być identyczne.
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>array_intersect</function></member>
|
|
<member><function>array_uintersect_assoc</function></member>
|
|
<member><function>array_intersect_uassoc</function></member>
|
|
<member><function>array_uintersect_uassoc</function></member>
|
|
<member><function>array_diff</function></member>
|
|
<member><function>array_diff_assoc</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|