Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 97

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>array_merge_recursive</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Array Functions"
HREF="ref.array.html"><LINK
REL="PREVIOUS"
TITLE="array_map"
HREF="function.array-map.html"><LINK
REL="NEXT"
TITLE="array_merge"
HREF="function.array-merge.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.array-map.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.array-merge.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.array-merge-recursive"
></A
>array_merge_recursive</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN7679"
></A
><P
>    (PHP 4 &#62;= 4.0.1)</P
>array_merge_recursive&nbsp;--&nbsp;Merge two or more arrays recursively</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN7682"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>array_merge_recursive</B
> ( array array1, array array2 [, array ...])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>array_merge_recursive()</B
> merges the elements of
     two or more arrays together so that the values of one are appended
     to the end of the previous one.  It returns the resulting array.
    </P
><P
>&#13;     If the input arrays have the same string keys, then the values for
     these keys are merged together into an array, and this is done
     recursively, so that if one of the values is an array itself, the
     function will merge it with a corresponding entry in another array
     too. If, however, the arrays have the same numeric key, the later
     value will not overwrite the original value, but will be appended.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN7700"
></A
><P
><B
>Example 1. <B
CLASS="function"
>array_merge_recursive()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>$ar1 = array ("color" =&#62; array ("favorite" =&#62; "red"), 5);
$ar2 = array (10, "color" =&#62; array ("favorite" =&#62; "green", "blue"));
$result = array_merge_recursive ($ar1, $ar2);</PRE
></TD
></TR
></TABLE
><P
>&#13;       The <TT
CLASS="literal"
>$result</TT
> will be:
       <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>Array
(
    [color] =&#62; Array
        (
            [favorite] =&#62; Array
                (
                    [0] =&#62; red
                    [1] =&#62; green
                )

            [0] =&#62; blue
        )

    [0] =&#62; 5
    [1] =&#62; 10
)</PRE
></TD
></TR
></TABLE
>
      </P
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     See also <A
HREF="function.array-merge.html"
><B
CLASS="function"
>array_merge()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.array-map.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.array-merge.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>array_map</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.array.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>array_merge</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>