Only Variables can be passed by reference error
You need to make the result of explode() a variable before you pass it on
$var = explode('.',$filename);
$ext = strtolower(array_pop($var));
That code is passing the result of the explode
function (a value) into array_pop
, but array_pop
expects an array variable (by reference), not a value. (The &
in the array_pop
declaration tells us that it's expecting to accept a reference.)
You can fix it by using an array variable to store the result of explode
, and then passing that into array_pop
.