views:

79

answers:

2

My print_r($view) function yields:

View Object
(
    [viewArray:View:private] => Array
        (
            [title] => Projet JDelage
        )
)
1

What does the "1" at the end mean? The PHP manual isn't very clear on how to parse the output of print_r....

Thanks,

JDelage

+10  A: 

You probably have echo print_r($view). Remove the echo construct. And... what need do you have to parse its output? There are certainly much better ways to solve your problem.

Ionuț G. Stan
or set return to true `print_r($view, true)` http://php.net/manual/en/function.print-r.php
maggie
Bingo, thank you. I meant parse as in understand, or read, for me, as a human being. Sorry - it was ambiguous...
JDelage
+2  A: 

print_r called with one argument (or with its second argument set to false), will echo the representation of its parameter to stdout. If it does this, it returns TRUE. Thus if you echo print_r($foo) you will print the contents of foo, followed by a string representation of the return value (which is 1).

Yuliy