What are the best practices for identifying which scripts are being called in a PHP application to debug errors or add extensions?

To identify which scripts are being called in a PHP application for debugging errors or adding extensions, you can use the `debug_backtrace()` function. This function returns an array of information about the current execution stack, including the file and line number of each function call.

// Use debug_backtrace() to get information about the current execution stack
$backtrace = debug_backtrace();

// Loop through the backtrace to get the file and line number of each function call
foreach ($backtrace as $trace) {
    echo "File: " . $trace['file'] . ", Line: " . $trace['line'] . "\n";
}