-1

This is a noob question but I'm a little confused. The thing is that I'm making a webpage which has a a lot of images that must be shown (it is a shop's website). My doubt is that I'm not sure about if I have to load this "collection" of pictures using php or javascript. I know php is executed on the server side and javascript on the client's but I don't fully understand the difference. Thank you all.

Josemafuen
  • 682
  • 2
  • 16
  • 41

1 Answers1

0

Very likely a duplicated question, however I wanted to share this tutorial with you, it is how to do that step by step on PHP.

In a nutshell using PHP you can create an array of image names like this:

$images = array("img1.png", "img2.png", "img3.jpg", "img4.jpg", "img5.gif");

And then cycle through all the array printing them like this:

for ($i=0; $i < 5; $i++) {
  echo "<img src='" . $images[$i] ."' /><br>";
}

Hope it helps, good luck!

adelriosantiago
  • 7,762
  • 7
  • 38
  • 71