How can including external PHP files impact the occurrence of parse errors in the main script?

Including external PHP files can impact the occurrence of parse errors in the main script if the included file contains syntax errors. To solve this issue, it's important to check the included files for any syntax errors before including them in the main script.

// Check the included file for syntax errors before including it
if (file_exists('external_file.php')) {
    $syntaxCheck = php_check_syntax('external_file.php');
    
    if ($syntaxCheck !== false) {
        include 'external_file.php';
    } else {
        echo 'Syntax error in external_file.php';
    }
} else {
    echo 'External file not found';
}