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