What is the best practice for calling a function defined in one PHP file from another PHP file without including unnecessary code?

To call a function defined in one PHP file from another PHP file without including unnecessary code, you can use the PHP `require_once` function to include the file containing the function definition. This ensures that the file is only included once to avoid any conflicts or errors. Once the file is included, you can simply call the function as you normally would.

// File containing the function definition
require_once 'functions.php';

// Call the function from the included file
$result = myFunction();
echo $result;