Optimized time complexity for problem 1 in PHP.
Reimplemented problem 6 in PHP (using array_sum).