What does "1" mean at the end of a php print_r statement?

Viewed 27623

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.

3 Answers

When using print_r to return, than than output/print the value, pass the 2nd parameter which defines return as true.

echo print_r($view, true);

This is useful if you want to save the results to a variable or concatenate with another string.

$var = 'The array is: ' . print_r($view, true);
Related