array_shift
the only parameter is an array passed by reference. The return value of explode(".", $value)
does not have any reference. Hence the error.
You should store the return value to a variable first.
$arr = explode(".", $value);
$extension = strtolower(array_pop($arr));
$fileName = array_shift($arr);
From PHP.net
The following things can be passed by reference:
- Variables, i.e. foo($a)
- New statements, i.e. foo(new foobar())
- [References returned from functions][2]
No other expressions should be passed by reference, as the result is undefined. For example, the following examples of passing by reference are invalid: