What are the potential issues with including multiple scripts from a central location in PHP?

One potential issue with including multiple scripts from a central location in PHP is that it can lead to naming conflicts if different scripts define functions or variables with the same name. To solve this issue, you can use namespaces to encapsulate the code in each script and prevent naming conflicts.

// script1.php
namespace Script1;

function myFunction() {
    // Function implementation
}

// script2.php
namespace Script2;

function myFunction() {
    // Function implementation
}

// main.php
require_once 'script1.php';
require_once 'script2.php';

Script1\myFunction(); // Call function from script1.php
Script2\myFunction(); // Call function from script2.php