What are common issues when using the include() function in PHP?

One common issue when using the include() function in PHP is that if the file being included does not exist, it will throw a warning and continue executing the script. To solve this issue, you can use the file_exists() function to check if the file exists before including it.

if (file_exists('file-to-include.php')) {
    include 'file-to-include.php';
} else {
    echo 'File does not exist.';
}