How can browser caching affect PHP file references?

When browser caching is enabled, the browser stores copies of files locally to reduce loading times. This can cause an issue when referencing PHP files as the browser may serve an outdated version instead of fetching the latest one from the server. To solve this issue, we can append a version number or timestamp to the PHP file references to force the browser to fetch the latest version.

<link rel="stylesheet" type="text/css" href="styles.css?v=<?php echo filemtime('styles.css'); ?>">
<script src="script.js?v=<?php echo filemtime('script.js'); ?>"></script>