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
.
print_r(variable, isStore) It is a built-in function in print_r in PHP that is used to print or display the contents of a variable. It essentially prints human-readable data about a variable. The value of the variable will be printed if it is a string, integer, or float.
If the parameter $isStore is set to TRUE then the print_r() function will return a string containing the information which it is supposed to print. print_r( $var1 ); echo "\n" ; print_r( $var2 );
It is an inbuilt function that is used in PHP to print or display the information stored in a variable. Basically it prints human-readable information about a variable. If the variable is a string, integer or float, the value itself will be printed.
The print and echo are both language constructs to display strings. The echo has a void return type, whereas print has a return value of 1 so it can be used in expressions. The print_r is used to display human-readable information about a variable.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With