What potential issues can arise when using require_once() and exit() in PHP scripts?

Using exit() after require_once() can cause unexpected behavior, as exit() immediately terminates the script execution. To avoid this issue, you can check if the required file exists before including it, and then use exit() only when necessary.

if (file_exists('config.php')) {
    require_once 'config.php';
} else {
    exit('Config file not found.');
}