cvs: phpdoc /en/reference/var/functions print-r.xml

From: Date: Sat, 12 Apr 2003 16:22:43 +0000
Subject: cvs: phpdoc /en/reference/var/functions print-r.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969352580@lists.php.net to get a copy of this message
alindeman Sat Apr 12 12:22:43 2003 EDT Modified files: /phpdoc/en/reference/var/functions print-r.xml Log: adding return argument Index: phpdoc/en/reference/var/functions/print-r.xml diff -u phpdoc/en/reference/var/functions/print-r.xml:1.3 phpdoc/en/reference/var/functions/print-r.xml:1.4 --- phpdoc/en/reference/var/functions/print-r.xml:1.3 Tue Sep 17 04:51:27 2002 +++ phpdoc/en/reference/var/functions/print-r.xml Sat Apr 12 12:22:43 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/var.xml, last change in rev 1.5 --> <refentry id="function.print-r"> <refnamediv> @@ -13,7 +13,13 @@ <methodsynopsis> <type>bool</type><methodname>print_r</methodname> <methodparam><type>mixed</type><parameter>expression</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>return</parameter></methodparam> </methodsynopsis> + <note> + <simpara> + The <parameter>return</parameter> parameter was added in PHP 4.3.0 + </simpara> + </note> <simpara> <function>print_r</function> displays information about a variable in a way that's readable by humans. If given a <type>string</type>, @@ -27,7 +33,6 @@ pointer to the end. Use <function>reset</function> to bring it back to beginning. </simpara> - &tip.ob-capture; <para> <informalexample> <programlisting role="php"> @@ -60,8 +65,34 @@ ) </pre> ]]> - </screen> - </para> + </screen> + </para> + <para> + If you would like to capture the output of <function>print_r</function>, + use the <parameter>return</parameter> parameter. If this parameter is set + to &true;, <function>print_r</function> will return its output, instead of + printing it (which it does by default). + </para> + <para> + <example> + <title><parameter>return</parameter> parameter example</title> + <programlisting role="php"> +<![CDATA[ +<?php + $b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z')); + $results = print_r ($b, true); //$results now contains output from print_r +?> +]]> + </programlisting> + </example> + </para> + <note> + <simpara> + If you need to capture the output of <function>print_r</function> with a + version of PHP prior to 4.3.0, use the <link linkend="ref.outcontrol"> + output-control functions</link>. + </simpara> + </note> <note> <simpara> Prior to PHP 4.0.4, <function>print_r</function> will continue forever

« previous php.doc (#969352580) next »