A function is a piece of code in a larger program. The function performs a specific task. The advantages of using functions are:
Reducing duplication of code
Decomposing complex problems into simpler pieces
Improving clarity of the code
Reuse of code
Information hiding
There are two basic types of functions. Built-in functions and user defined ones. The built-in functions are part of the PHP language. Examples are: phpinfo(), round() or abs(). The user defined functions are created by application programmers to cover their needs. They are created with the function keyword.