PHP Functions
Defining and using functions.
PHP Functions
The real power of PHP comes from its functions.
PHP has more than 1000 built-in functions, and in addition you can create your own constructor functions.
User Defined Functions
A user-defined function declaration starts with the word function:
function functionName() {
code to be executed;
}
Note: A function name must start with a letter or an underscore. Function names are NOT case-sensitive.
PHP Function Arguments
Information can be passed to functions through arguments. An argument is just like a variable.
PHP Strict Types
In PHP 7, type declarations were added. This gives us an option to specify the data type expected when declaring a function, and by adding the strict_types declaration, it will throw a "Fatal Error" if the data type mismatches.