How does the status code 206, Partial Content, relate to PHP functions like displaying different images on a website?

When a website needs to display different images based on user requests, the server can respond with a status code 206, Partial Content, to indicate that only a portion of the requested resource is being sent. This is useful when the server wants to send specific images based on user preferences without sending the entire set of images.

<?php
$requestedImage = $_GET['image'];

if ($requestedImage == 'image1') {
    header('HTTP/1.1 206 Partial Content');
    echo file_get_contents('image1.jpg');
} elseif ($requestedImage == 'image2') {
    header('HTTP/1.1 206 Partial Content');
    echo file_get_contents('image2.jpg');
} else {
    header('HTTP/1.1 404 Not Found');
    echo 'Image not found';
}
?>