How can PHP be used to ensure that updated images are displayed immediately on a website without the need for manual refresh?

When images are updated on a website, the browser may cache the old image and not display the new one unless the page is manually refreshed. To ensure that updated images are displayed immediately without manual refresh, you can append a unique query string to the image URL in the HTML code. This query string can be generated using PHP to make the browser think it is a new image and fetch it from the server.

<img src="image.jpg?<?php echo time(); ?>" alt="Updated Image">