Skip to content

Instantly share code, notes, and snippets.

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