PHP solutions for problems 6, 13, 20, and 22.