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.
Asked
Active
Viewed 392 times
-1
-
1PHP is probably the best idea. – putvande Feb 07 '16 at 20:15
-
1Possible duplicate of [Difference between Javascript and PHP](http://stackoverflow.com/questions/6369313/difference-between-javascript-and-php) – Kevin Kopf Feb 07 '16 at 20:25
1 Answers
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