Only variables should be passed by reference

后端 未结 12 1452
囚心锁ツ
囚心锁ツ 2020-11-22 06:14
// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = $_FILES[$upload_name][\'name\'];
//echo \"testing-\".$file_name.\"
\"; //$file_name = strtolower
12条回答
  •  长情又很酷
    2020-11-22 06:31

    Assign the result of explode to a variable and pass that variable to end:

    $tmp = explode('.', $file_name);
    $file_extension = end($tmp);
    

    The problem is, that end requires a reference, because it modifies the internal representation of the array (i.e. it makes the current element pointer point to the last element).

    The result of explode('.', $file_name) cannot be turned into a reference. This is a restriction in the PHP language, that probably exists for simplicity reasons.

提交回复
热议问题