Backend and Infrastructure

Cleaner Code with PHP Functions

Sprout Video

Our form is working well now, and to finish up, in this tutorial we're going to clean up and reorganize our code a little bit by moving things into a new custom function, called save_pets(). This won't change how the form works, but moving logic into functions gives us two advantages, re-usable code, and making it clearer what the code we've written does, and is intended for.

Additional resources

Explore more PHP tutorials