Sophie

Sophie

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

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

<HTML
><HEAD
><TITLE
>print_r</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="Variable Functions"
HREF="ref.variables.html"><LINK
REL="PREVIOUS"
TITLE="isset"
HREF="function.isset.html"><LINK
REL="NEXT"
TITLE="serialize"
HREF="function.serialize.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.isset.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.serialize.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.print-r"
></A
>print_r</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN94316"
></A
><P
>    (PHP 4 )</P
>print_r&nbsp;--&nbsp;
     Prints human-readable information about a variable
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN94319"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>print_r</B
> ( mixed expression)<BR
></BR
><P
>&#13;     <B
CLASS="function"
>print_r()</B
> displays information about a variable
     in a way that's readable by humans.  If given a <A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
>,
     <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
> or <A
HREF="language.types.float.html"
><B
CLASS="type"
>float</B
></A
>, the value itself will be
     printed.  If given an <A
HREF="language.types.array.html"
><B
CLASS="type"
>array</B
></A
>,
     values will be presented in a format that shows keys and
     elements.  Similar notation is used for <A
HREF="language.types.object.html"
><B
CLASS="type"
>object</B
></A
>s.
    </P
><P
>&#13;     Remember that <B
CLASS="function"
>print_r()</B
> will move the array
     pointer to the end. Use <A
HREF="function.reset.html"
><B
CLASS="function"
>reset()</B
></A
> to bring
     it back to beginning.
    </P
><DIV
CLASS="tip"
><BLOCKQUOTE
CLASS="tip"
><P
><B
>Tip: </B
>As with anything that outputs
its result directly to the browser, you can use the <A
HREF="ref.outcontrol.html"
>output-control functions</A
> to capture
the output of this function, and save it in a
<A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
> (for example).</P
></BLOCKQUOTE
></DIV
><P
>&#13;     <DIV
CLASS="informalexample"
><A
NAME="AEN94342"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;pre&#62;
&#60;?php
    $a = array ('a' =&#62; 'apple', 'b' =&#62; 'banana', 'c' =&#62; array ('x','y','z'));
    print_r ($a);
?&#62;
&#60;/pre&#62;</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><P
>&#13;     Which will output:
     <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>&#60;pre&#62;
Array
(
    [a] =&#62; apple
    [b] =&#62; banana
    [c] =&#62; Array
        (
            [0] =&#62; x
            [1] =&#62; y
            [2] =&#62; z
        )
)
&#60;/pre&#62;</PRE
></TD
></TR
></TABLE
>
     </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      Prior to PHP 4.0.4, <B
CLASS="function"
>print_r()</B
> will continue forever
      if given an <A
HREF="language.types.array.html"
><B
CLASS="type"
>array</B
></A
> or <A
HREF="language.types.object.html"
><B
CLASS="type"
>object</B
></A
> that
      contains a direct or indirect reference to itself.  An example
      is <TT
CLASS="literal"
>print_r($GLOBALS)</TT
> because
      <TT
CLASS="literal"
>$GLOBALS</TT
> is itself a global variable that
      contains a reference to itself.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;      See also <A
HREF="function.ob-start.html"
><B
CLASS="function"
>ob_start()</B
></A
>, <A
HREF="function.var-dump.html"
><B
CLASS="function"
>var_dump()</B
></A
>,
      and <A
HREF="function.var-export.html"
><B
CLASS="function"
>var_export()</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.isset.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.serialize.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>isset</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.variables.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>serialize</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>