What are some best practices for using the include function in PHP to avoid errors?

When using the include function in PHP, it's important to ensure that the file being included exists and is properly formatted to avoid errors. One best practice is to use the `file_exists` function to check if the file exists before including it. Additionally, using the `@` symbol before the include function can suppress any errors that may occur during the file inclusion process.

$file = 'somefile.php';

if(file_exists($file)) {
    @include($file);
} else {
    echo "File does not exist.";
}