What are the potential pitfalls of using require statements in PHP, especially in complex scripts with many conditional includes?

Using require statements in PHP can lead to issues in complex scripts with many conditional includes, as it can result in fatal errors if the required file is not found. To avoid this, you can use the file_exists function to check if the file exists before including it.

$file_path = 'path/to/file.php';

if (file_exists($file_path)) {
    require $file_path;
} else {
    // Handle error or fallback
}