get all the images from a folder in php

To get all the images from a folder in PHP, you can use the glob function. This function searches for all the pathnames matching a given pattern, and returns them in an array.

Here's an example of how you can use glob to get all the images from a folder:

<?php

$folder = '/path/to/folder';
$images = glob($folder . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);

foreach ($images as $image) {
  // do something with the image
}

Watch a course Learn object oriented PHP

This will search for all files with the extension .jpg, .jpeg, .png, or .gif in the $folder directory, and return them in an array. You can then iterate over the array and do something with each image.

Note: The glob function only works with files that are located on the server. It cannot be used to access files that are stored on the client's computer.