print_r
print_r
Prints human-readable information about a variable
**print_r** mixed $value bool $return
displays information about a variable
in a way that's readable by humans.
print_r
, and
will
also show protected and private properties of objects.
Static class members will not be shown.
print_r``var_dump``var_export
valueThe expression to be printed.
return
If you would like to capture the output of ,
use the parameter. When this parameter is set
to true, will return the information rather than print it.
print_r``return``print_r
If given a , or ,
the value itself will be printed. If given an , values
will be presented in a format that shows keys and elements. Similar
notation is used for s.
string``int``float``array``object
When the parameter is true, this function
will return a . Otherwise, the return value is true.
return``string
Voorbeeld: example
<pre>
<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r($a);
?>
</pre>
<pre>
Array
(
[a] => apple
[b] => banana
[c] => Array
(
[0] => x
[1] => y
[2] => z
)
)
</pre>
Voorbeeld: parameter example
<?php
$b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z'));
$results = print_r($b, true); // $results now contains output from print_r
print_r($results);
?>
ob_start``var_dump``var_export