How can the include() function in PHP be used to streamline the process of updating common elements on multiple pages?

When common elements like headers, footers, or navigation menus need to be updated across multiple pages, the include() function in PHP can be used to streamline the process. By creating separate PHP files for these common elements and including them in each page using include(), any updates made to the included files will automatically reflect on all pages without having to manually update each one individually.

<?php
// header.php
echo "<header>This is the header</header>";

// footer.php
echo "<footer>This is the footer</footer>";

// index.php
include('header.php');
echo "<p>Main content of the page</p>";
include('footer.php');
?>