如何修复“严格标准:只应通过引用传递变量”?

Can someone please help me with these 4 lines of code. I been trying to read how to fix this error but I'm not very familiar with php that much yet.

$currentFile = $_SERVER["SCRIPT_NAME"];
$img = array_pop(explode("/", $currentFile));
$fileName = basename($img, ".php").PHP_EOL;
echo $fileName;

This script finds the current $.php name and spits it out. It also cuts the location of the file and the extension as well... leaving just the fileName.

How would I write these 4 lines of code to not throw that Strict Standard error

Just add a varible.

$currentFile = $_SERVER["SCRIPT_NAME"];
$ret = explode("/", $currentFile);
$img = array_pop($ret);
$fileName = basename($img, ".php").PHP_EOL;
echo $fileName;

But you could just use basename only, the below code will give you same result:

$fileName = basename($_SERVER["SCRIPT_NAME"], ".php").PHP_EOL;