Fixed strict standards warning

Strict standards warning at line 14 due to passing a function result to
end() which expects a variable passed by reference. Creating an
intermediate variable fixes the problem.
Fixed strict standards warning (2)

Went through and fixed all instances of end(array_keys($...)) by
declaring an intermediate variable
Merge pull request #15 from GaryA/bugfixes

Fix warning due to passing a function result to end()