What PHP function can be used to retrieve the filename of a PHP script?

To retrieve the filename of a PHP script, you can use the `basename()` function in PHP. This function takes a path as an argument and returns the filename component of that path. By passing `__FILE__` as the argument to `basename()`, you can get the filename of the current PHP script.

$filename = basename(__FILE__);
echo $filename;