Created solution to Problem 6 using PHP.