solved problem 11 in php