PHP code for problem 7