Calculates score for a bowling game in php