How to use PHP print_r() Function
7 January, 20122 Comments
This PHP Tutorial will give you some information about “PHP print_r() function”, which includes Syntax, Examples, Usage and output. The print_r() will print any array including multidimensional Arrays. The return parameter will let you capture the output of print_r(). When this parameter is set to TRUE, print_r() will return the information rather than print it.
Syntax
mixed print_r ( mixed $expression [, bool $return = false ] )
PHP print_r() Function
'Certification ',
'b' => 'Paths',
'c' => array ('ccna', 'ccnp', 'ccie'));
print_r ($myar);
?>
Output
Array
(
[a] => This php code
[b] => is written by
[c] => Array
(
[0] => noob
[1] => prof
[2] => expert
)
)
Return Statement
Or you can use another variable to store output from print_r and later echo it to get the above output again.
$results = print_r($myar, true);
echo $results;
Comments
Hi from my end,
I liked your site: “ispsd.com”. Can we email about a proposition with your site? This is regarding a posting in your site. I can surely render certain benefits to you.
Looking for your reply.
Regards,
Sudipto
Please use feedback or contact us option.