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.

Solution: Writing a PHP class sorter

Solution: Writing a PHP class sorter

(upbeat music) - [Instructor] All right, I hope you got some good code. Here's what I came up with. Also, remember, even if we use the same exact prompts, we might get different results. Now, I'm using GitHub's Copilot. If you used something like ChatGPT, you'll have to go through this process as well, as you likely found. GitHub's Copilot cannot read a full directory, which means that if I wanted to use some code I've already written, I need to give that code to the AI. So that's the first thing I'm going to do. I'm going to highlight the Person class, and in my chat box, I'm going to say, here's the Person class, and actually, I'm going to highlight this, and then I'm going to move over to index, 'cause that's the main file I want to work in. Here's the Person class I am using in the open index.php file, and then I'll come over here, copy this, make sure it's copied, and paste it in. So now, GitHub Copilot knows that this class exists. It has the context, it's learning about it, and…

Contents