From the course: Building PHP Applications with Generative AI

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Writing a PHP class sorter

Challenge: Writing a PHP class sorter

(light music) - [Instructor] It's time for another challenge. Using AI, we're going to write a PHP class sorter to use in our programs. As needed, we'll test and confirm everything works. Here are the requirements. Provided are a person class and a list of person objects in an index.php file. We want to use the provided code and AI to write a function that sorts first by age, then by name if the ages match. Next, we want a function that will take the list of person objects and separate it into two lists, one for professionals and one for hobbyists. Use whatever AI you'd like to help you generate the code, but make sure to test. You can find the starting code in the GitHub repository, and of course, come back to see my solution.

Contents