functions.php

Built-in function

strtoupper('hello') = HELLO

User-defined function

addTwo(5) = 7

Explanation

A function is a bunch of code that runs when you call it to. PHP has built-in functions like strtoupper() that do some very common tasks. You can also write your own functions to reuse code, keep your page organized, and you can even avoid repeating the same steps. Functions can take input and return results.

Back