This probably starts to fall on the technical side of PHP, but if I had to guess, the explode() function returns a reference in memory pointing to the array that it generated. By wrapping that function inside end() you are asking it to send the reference directly to another function (which is fine).
The reason you get this error though is the fact that it is preferred to have a variable to help prevent memory leaks. If you didn't use the returned value of explode() you will have memory being set that is never utilized/cleared out (until Garbage Collection occurs).
To get around the error, use the following:
$extensions = explode(".", $file);
$actualext = end($extensions);