PHP Function Examples
Predefined Function
This Function Turns The First Letter Of Each Word Into An Uppercase Letter.
User-Defined Function
This Function Lists Off Menu Items and Their Prices.
A bag of Chips will cost $2.99.
A bag of Candy will cost $1.50.
A bag of Licorice will cost $4.
A bag of Pretzels will cost $2.
How Functions Work
Functions are helpful for storing information and being able to use it throughout the code. This is useful for not having to write the same code multiple times, and it cleans up the code by making it shorter with a more organized look.