PHP already has a lot of [built-in functions][builtin-functions]. Besides the built-in functions already provided by PHP it is also possible to define your own functions. Functions are used to group code into something useful, it organizes your code.
Generally speaking a function is a piece of code with an input, some defined actions based on the input and an output and then an optional return value:
INPUT --> PROCESSING --> OUTPUT
A function therefore is a little program inside a larger program. It sometimes is called subroutine as well because of that.