Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Output array key and value foreach loop php
<?php
$books["978"] = "Jjaj";
$books["978"] = "The Pepe";
$books["978"] = "Jackie's Fables";
$books["978"] = "Mahabhartazaa";
?><html>
<head>
<title>Five Great Books</title>
</head>
<body>
<h1>Five Great Books</h1>
<ul>
<?php foreach($books as $isbn => $book) { ?>
<li><?php echo $isbn; echo $book; ?></li>
<?php } ?>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment