How can functions be outsourced and included only once in PHP to improve script maintainability?

To improve script maintainability in PHP, functions can be outsourced to separate files and included only once using the `require_once` or `include_once` functions. This ensures that the functions are included only once in the script, preventing any potential conflicts or errors that may arise from multiple inclusions.

// functions.php
function myFunction() {
    // Function code here
}

// main.php
require_once 'functions.php';

// Now you can use myFunction() in main.php without worrying about multiple inclusions
myFunction();