Sophie

Sophie

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

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

<HTML
><HEAD
><TITLE
>array_reverse</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_reduce"
HREF="function.array-reduce.html"><LINK
REL="NEXT"
TITLE="array_search"
HREF="function.array-search.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-reduce.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-search.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.array-reverse"
></A
>array_reverse</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN7982"
></A
><P
>    (PHP 4 )</P
>array_reverse&nbsp;--&nbsp;
     Return an array with elements in reverse order
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN7985"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>array_reverse</B
> ( array array [, bool preserve_keys])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>array_reverse()</B
> takes input
     <TT
CLASS="parameter"
><I
>array</I
></TT
> and returns a new array with the
     order of the elements reversed, preserving the keys if
     <TT
CLASS="parameter"
><I
>preserve_keys</I
></TT
> is <TT
CLASS="constant"
><B
>TRUE</B
></TT
>.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN8002"
></A
><P
><B
>Example 1. <B
CLASS="function"
>array_reverse()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>$input  = array ("php", 4.0, array ("green", "red"));
$result = array_reverse ($input);
$result_keyed = array_reverse ($input, TRUE);</PRE
></TD
></TR
></TABLE
><P
>&#13;       This makes both <TT
CLASS="varname"
>$result</TT
> and
       <TT
CLASS="varname"
>$result_keyed</TT
> have the same elements, but
       note the difference between the keys. The printout of
       <TT
CLASS="varname"
>$result</TT
> and
       <TT
CLASS="varname"
>$result_keyed</TT
> will be:
       <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>Array
(
    [0] =&#62; Array
        (
            [0] =&#62; green
            [1] =&#62; red
        )

    [1] =&#62; 4
    [2] =&#62; php
)
Array
(
    [2] =&#62; Array
        (
            [0] =&#62; green
            [1] =&#62; red
        )

    [1] =&#62; 4
    [0] =&#62; php
)</PRE
></TD
></TR
></TABLE
>
      </P
></DIV
></TD
></TR
></TABLE
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      The second parameter was added in PHP 4.0.3.
     </P
></BLOCKQUOTE
></DIV
></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-reduce.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-search.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>array_reduce</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_search</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>