<?php
// Get a list of all the .jpg files in the img/fruit directory:
$jpgs = glob('../img/fruit/*.jpg');
// Get a list of all the .webp files in the img/fruit directory:
$webps = glob('../img/fruit/*.webp');
// Combine both arrays into one:
$files = array_merge( $jpgs, $webps );
// Sort the array by filename:
sort( $files );
// Loop through each file and display it as an image:
foreach( $files as $file ) {
?>
<img src="<?php echo $file; ?>"
width="200"
height="200"
style="border: 1px solid black;">
<?php
}