PHP严格标准:只有变量才能通过引用传递

PHP严格标准:只有变量才能通过引用传递,php,Php,我的PHP函数中有一行: $extension = strtolower(end(explode('.',$fileName))); 在行动中,我看到了这个错误: Strict Standards: Only variables should be passed by reference in ... 如何修复此错误?从技术上讲,这将是 $parts = explode('.',$fileName); $extension = strtolower(end($parts)); 但是 这是

我的PHP函数中有一行:

$extension = strtolower(end(explode('.',$fileName))); 
在行动中,我看到了这个错误:

Strict Standards: Only variables should be passed by reference in ...

如何修复此错误?

从技术上讲,这将是

$parts = explode('.',$fileName);
$extension = strtolower(end($parts));
但是

这是你应该使用的

$ext = strtolower( pathinfo($fileName, PATHINFO_EXTENSION) );