Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. //create 2 dimansional array
  3. $bands = array(
  4. array("green-day.jpg", "Green Day"),
  5. array("imagine-dragons.jpg", "Imagine Dragons"),
  6. array("kings-of-leon.jpg", "Kings of Leon"),
  7. array("kodaline.jpg", "Kodaline"),
  8. array("live.jpg", "LIVE")
  9. );
  10. // create arrlen to modulate for loops
  11. $arrlen = count($bands);
  12. //open table
  13. echo "<table BORDER=1>";
  14. echo "<tr>";
  15. //for each entry in $bands array execute the following.
  16. //this inserts the pictures in the first row.
  17. for ($x = 0; $x < $arrlen; $x++){
  18. echo "<td> <img src=".$bands[$x][0]." width=244</img></td>";
  19. }
  20. // close and open table row
  21. echo "</tr><tr>";
  22. //insert 2nd layer array data in the cells.
  23. for ($x = 0; $x < $arrlen; $x++){
  24. echo "<td align=center>".$bands[$x][1]."</td>";
  25. }
  26. echo "</tr>";
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement