PHP procedural for Problem 1