How can PHP be utilized to handle image placeholders when images are not available on the external FTP server?

When images are not available on an external FTP server, PHP can be utilized to handle image placeholders by checking if the image exists on the server. If the image does not exist, a placeholder image can be displayed instead. This can be achieved by using the file_exists() function in PHP to check if the image file exists on the server.

$image_url = 'http://example.com/image.jpg';

if (file_exists($image_url)) {
    echo '<img src="' . $image_url . '" alt="Image">';
} else {
    echo '<img src="placeholder.jpg" alt="Placeholder Image">';
}