Functions like var_dump and print_r are also invaluable
when debugging
var_dump
var_dump functions displays information about variables in a
simple, readable
format. This function is very useful when debugging—providing a
simple
and easy way to display the current contents of one or more
variables.
For simple scalar variables such as booleans, integers,
strings, and doubles,
the type of the variable is printed, followed by an
opening bracket, the value
contained in the variable, and a closing bracket.
Arrays are printed as a list of keys and values, and have their
type array
printed at the top of the list.
print_r
print_r displays information about a variable in a
format meant to
be easily understandable by humans. It is often used for
debugging—
providing a simple and easy way to display the current contents of a
variable.
However, var_dump provides more complete information and
allows
for the use of multiple arguments.
For simple scalar variables, such as booleans, integers,
strings,
and doubles, the value contained in the variable is printed.
If print_r is used on a data structure that is a
reference to itself,
the function enters a recursive loop—generating the same
information
repeatedly until the script times out or the user cancels the
script.