Skip to content

Instantly share code, notes, and snippets.

@amouratoglou
Created November 24, 2019 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amouratoglou/ba3da89b3708d60f14039a81073fe5e8 to your computer and use it in GitHub Desktop.
Save amouratoglou/ba3da89b3708d60f14039a81073fe5e8 to your computer and use it in GitHub Desktop.
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