What is the purpose of including a simple gallery script with thumbnail function in a PHP website?

Including a simple gallery script with a thumbnail function in a PHP website allows users to easily navigate and view images in a visually appealing way. Thumbnails provide a preview of the images, making it easier for users to select which ones they want to view in full size. This enhances the user experience and makes the website more engaging.

<?php
// Gallery script with thumbnail function
$images = array("image1.jpg", "image2.jpg", "image3.jpg");

echo "<div class='gallery'>";
foreach($images as $image) {
    echo "<a href='images/$image'><img src='thumbnails/$image' alt='Image'></a>";
}
echo "</div>";
?>