For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > April 2007 > #40980 [Com]: Incorrect output labeled on print_r









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #40980 [Com]: Incorrect output labeled on print_r
tayloj1 at uk dot ibm dot com

2007-04-23, 6:59 pm

ID: 40980
Comment by: tayloj1 at uk dot ibm dot com
Reported By: php at htmlland dot net
Status: Open
Bug Type: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
New Comment:

Ref: bool print_r ( mixed $expression [, bool $return] )

Agree that the return on print_r() should be "mixed" not "bool" as
print_r either returns a bool or a string:

If $return is not specified or set to false then print_r returns
a bool of TRUE if command is successful - or -
a bool of FALSE on error

If $return == TRUE then print_r either returns
a string if command completes OK - or -
a bool FALSE on errors

Correct syntax is:

mixed print_r ( mixed $expression [, bool $return] )

Although "mixed" is not very descriptive, this usage is consistent with
the rest of the documentation.


Previous Comments:
------------------------------------------------------------------------

[2007-04-08 19:42:47] ezyang@php.net

"Mixed" is not terribly descriptive though. Maybe...

Index: en/reference/var/functions/print-r.xml
========================================
===========================
RCS file: /repository/phpdoc/en/reference/var/functions/print-r.xml,v
retrieving revision 1.12
diff -u -r1.12 print-r.xml
--- en/reference/var/functions/print-r.xml 7 Mar 2006 01:12:15
-0000 1.12
+++ en/reference/var/functions/print-r.xml 8 Apr 2007 19:42:19 -0000
@@ -11,7 +11,7 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
- <type>bool</type><methodname>print_r</methodname>
+ <type>bool/string</type><methodname>print_r</methodname>

<methodparam><type>mixed</type><parameter>expression</parameter></methodparam>
<methodparam
choice="opt"><type>bool</type><parameter>return</parameter></methodparam>
</methodsynopsis>

I don't know if we allow that.

------------------------------------------------------------------------

[2007-04-05 09:55:13] rquadling@php.net

The return parameter was added in PHP4.3.0 and this does change the
return type.

As this is the current way print_r() operates, then I agree with you
that it should and that the old behaviour should be recorded.

------------------------------------------------------------------------

[2007-04-02 18:29:15] php at htmlland dot net

Description:
------------
Shoulden't the return on print_r() be mixed not bool as shown on the
documentation page? I say this because the return parameter changes the
output returned to a string not a bool.



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=40980&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com