As per the title, is there PHP equivalent of __name__ == \"__main__\"?
__name__ == \"__main__\"
Is there something that would work for both scripts executed through the command line
if (!count(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))) { // some usefull stuff }
look at https://www.php.net/manual/en/function.debug-backtrace.php for more details on debug_backtrace function