What are the best practices for separating CSS, JavaScript, HTML, and PHP code to ensure clean code structure?

To ensure a clean code structure, it is best practice to separate CSS, JavaScript, HTML, and PHP code into their respective files. This separation helps improve readability, maintainability, and reusability of code. By organizing code into separate files, it becomes easier to make changes, troubleshoot issues, and collaborate with other developers.

<?php
include 'header.php'; // Include HTML header
include 'styles.css'; // Include CSS styles
?>

<div class="container">
  <h1>Welcome to my website!</h1>
  <p>This is a paragraph of text.</p>
</div>

<?php
include 'scripts.js'; // Include JavaScript scripts
include 'footer.php'; // Include HTML footer
?>