mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 07:02:06 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@152273 c90b9560-bf6c-de11-be94-00142212c4b1
95 lines
2.7 KiB
XML
95 lines
2.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.12 $ -->
|
|
|
|
<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 -->
|
|
<!-- last change to 'array-diff' in en/ tree in rev 1.14 -->
|
|
<refentry id="function.array-diff">
|
|
<refnamediv>
|
|
<refname>array_diff</refname>
|
|
<refpurpose>Calcule la différence entre deux tableaux</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_diff</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_diff</function> retourne un tableau
|
|
qui contient toutes les valeurs du tableau <parameter>array1</parameter>
|
|
qui sont absentes de tous les autres arguments.
|
|
Notez que les clés sont préservées.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>array_diff</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = array ("a" => "vert", "rouge", "bleu", "rouge");
|
|
$array2 = array ("b" => "vert", "jaune", "rouge");
|
|
$result = array_diff ($array1, $array2);
|
|
print_r($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Les valeurs multiples dans <varname>$array1</varname> seront toutes
|
|
traitées de la même façon. L'exemple va afficher :
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[1] => bleu
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Deux éléments sont considérés comme égaux si et seulement si
|
|
<literal>(string) $elem1 === (string) $elem2</literal>. En clair :
|
|
lorsque la représentation en chaîne de caractères est identique.
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
</note>
|
|
<warning>
|
|
<simpara>
|
|
Cette fonction était inutilisable en &php; 4.0.4!
|
|
<!-- TODO: when exactly was this broken?... -->
|
|
</simpara>
|
|
</warning>
|
|
<para>
|
|
Voir aussi
|
|
<function>array_diff_assoc</function>,
|
|
<function>array_intersect</function> et
|
|
<function>array_intersect_assoc</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
|
|
-->
|