Bowling Kata solution in PHP