What are the best practices for loading external PHP files that contain classes or functions?

When loading external PHP files that contain classes or functions, it is best practice to use the include or require functions. This ensures that the contents of the external file are loaded into the current script, making the classes and functions available for use. Additionally, using include_once or require_once can prevent issues with duplicate declarations if the file is loaded multiple times.

// Include external PHP file with classes or functions
require_once 'external_file.php';

// Now you can use the classes or functions from the external file
$obj = new ClassName();
$result = functionName();