Mozilor Technologies interview question

A basic PHP solution for an problem.