Php 严格标准:数组中只能通过引用传递变量

Php 严格标准:数组中只能通过引用传递变量,php,arrays,strict,Php,Arrays,Strict,以上代码报告strick标准警告,小脚本如下: $name = substr($name, 0, -strlen($ext)) . "_medium." . end(explode('.',$name)); 如何修复此警告?需要帮助:) 但是为什么不使用将错误报告更改为30719end()通过引用获取数组,只能通过引用传递变量。可能存在重复的 function medium($name) { $ext = strrchr($name, '.'); if($ext !== f

以上代码报告strick标准警告,小脚本如下:

$name = substr($name, 0, -strlen($ext)) . "_medium." . end(explode('.',$name));
如何修复此警告?需要帮助:)


但是为什么不使用

将错误报告更改为
30719

end()
通过引用获取数组,只能通过引用传递变量。可能存在重复的
  function medium($name) {
    $ext = strrchr($name, '.');
    if($ext !== false) {
        $name = substr($name, 0, -strlen($ext)) . "_medium." . end(explode('.',$name));
    }
    return $name;
  }

  function thumb($name) {
    $ext = strrchr($name, '.');
    if($ext !== false) {
        $name = substr($name, 0, -strlen($ext)) . "_thumb." . end(explode('.',$name));
    }
    return $name;
  }

  function name_remove($name) {
    $name = str_replace("_medium", "", $name);
    $name = str_replace("_thumb", "", $name);
    return $name;
  }
$blocks = explode('.',$name);
$name = substr($name, 0, -strlen($ext)) . "_medium." . end($blocks);