In what situations would using include or require for separate scripts be more beneficial than the current approach?

When you have common functions or classes that are used across multiple scripts, it can be more beneficial to use include or require statements to avoid duplicating code and ensure consistency. This approach also makes it easier to update shared code in one place rather than making changes in multiple scripts.

// common.php
function sayHello() {
    echo "Hello, World!";
}

// script1.php
include 'common.php';
sayHello();

// script2.php
include 'common.php';
sayHello();