Output two dimensional array with print_r in PHP
Description
The following code shows how to output two dimensional array with print_r.
Example
<!DOCTYPE html>// www .j a v a2s . co m
<html>
<body>
<h1>A Two-Dimensional Array</h1>
<?php
$myBooks = array(
array(
"title" => "XML",
"author" => "A",
"pubYear" => 2011
),
array(
"title" => "HTML",
"author" => "B",
"pubYear" => 2012
),
array(
"title" => "CSS",
"author" => "J",
"pubYear" => 2013
),
array(
"title" => "Java",
"author" => "D",
"pubYear" => 2014
),
);
echo "<pre>";
print_r ( $myBooks );
echo "</pre>";
?>
</body>
</html>
The code above generates the following result.