How can the current full path be accurately output in PHP, especially when SCRIPT_FILENAME may not work locally?

When working with PHP, the current full path can be accurately output by using the `__FILE__` magic constant, which represents the full path and filename of the script. This constant can be used in conjunction with `dirname(__FILE__)` to get the directory path of the current script. This method is reliable and works both locally and on remote servers.

$currentPath = dirname(__FILE__);
echo "Current full path: " . $currentPath;