PHP Functions
PHP supports many built-in functions for common programming tasks. These functions may be in the standard PHP distribution or in additional extensions compiled with it, or written by individual developers.
Functions are pieces of code that perform an action against multiple items, locations or values. They are often used to reduce the amount of repetitive, tedious code that must be written in a program. The standard PHP distribution contains more than 1,000 built-in functions.
A function can take in information through what are called arguments. Arguments are specified after the function name, inside of parentheses. They can be any data type, including arrays, integers and floats. The function will use these as input and return the result of the function based on the input it receives.
In PHP, function arguments are usually passed by value and can not be changed after the function has been called. However, you can also pass a function a return type and require that the returned value match this return type. To use a return type, simply add a colon and the desired return type to the function declaration just before the opening curly bracket.