Home / PHP Tips Generated By ChatGPT / Getting the Current Script’s Filename in PHP Use basename(__FILE__) to get the current script’s filename. Source Code echo "Current script name: " . basename(__FILE__);