Outputting Arrays with print_r()

Outputting Arrays with print_r()

$authors:

Array
(
    [0] => Steinbeck
    [1] => Kafka
    [2] => Tolkien
    [3] => Dickens
)

$myBook:

Array
(
    [title] => The Grapes of Wrath
    [author] => John Steinbeck
    [pubYear] => 1939
)
 

CODE FOLLOWS

<?php
// Include the header file (assumed to contain common HTML and styles)
include('includes/header.php');
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Outputting Arrays with print_r()</title>
    <link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<h1>Outputting Arrays with print_r()</h1>

<?php

$authors 
= array( "Steinbeck""Kafka""Tolkien""Dickens" );

$myBook = array( "title" => "The Grapes of Wrath",
    
"author" => "John Steinbeck",
    
"pubYear" => 1939 );

echo 
'<h2>$authors:</h2><pre>';
print_r $authors );
echo 
'</pre><h2>$myBook:</h2><pre>';
print_r $myBook );
echo 
"</pre>";

?>

</body>
</html>

<?php
// Include the footer file (assumed to contain closing HTML and scripts)
include('includes/footer.php');
?>