PHP/Utility Function/print r
Examining an Array with print_r()
<source lang="html4strict">
<html> <head> <title>Testing the print_r() Function</title> </head> <body>
<?php $characters = array (
array ( "name"=> "bob", "occupation" => "A", ), array ( "name" => "sally", "occupation" => "B", ) );
print_r( $characters); ?>
</body> </html>
</source>
print_r(,true ) passes its output back as its return value, and not print anything out.
<source lang="html4strict">
<?
$myarray = array("Apples", "Oranges", "Pears"); $size = count($myarray); $output = print_r($myarray, true); print $output;
?>
</source>