How can the file_exists() function be utilized to include different HTML files based on the value of a parameter in the $_GET array in PHP?

To include different HTML files based on the value of a parameter in the $_GET array in PHP, you can use the file_exists() function to check if the file exists before including it. This can help prevent errors if the file does not exist. By using file_exists() in combination with conditional statements, you can dynamically include different HTML files based on the parameter value.

if(isset($_GET['page']) && file_exists($_GET['page'] . '.html')) {
    include($_GET['page'] . '.html');
} else {
    include('default.html');
}