Print_r optional parameter correction

(pg. 38)

In the book, the print_r() function is described as follows:

print_r($variable)

Output the contents of $variable . Typically used to display the contents of an array.

However, there is also an optional flag for the print_r() function that makes the function return the output rather than printing it to the screen. Therefore, the section of the book should be amended as follows:

print_r($variable [,return])

return – [optional] $boolean default: FALSE, print output
Output the contents of $variable. Typically used to display the contents of an array. If return is set to TRUE, print_r() returns the output rather than displaying it, such as when storing it in a variable.


Similar Posts: