My attempt to solve problems in CodeEval using PHP