Definition of function
Function: A block of code that performs a specific function
functionFunction name ([Parameter type Qualified parameter list]) : Return value type qualification{function bodyreturnThe return value.1. The function can only return a single value, and the data type of the returned value can be any type2.function encountersreturnStatement to immediately end program execution,returnThe following code will not be executed}Copy the code
2. Parameters of a function
Arguments to a function, separated by commas.
The functions of function parameters are as follows: 1. Without parameters, the task is fixed. 2. There are parameters, and you can use the data that the user passes in to determine how the program in the function should be executed, and the parameter list of the function is the interface that the user provides when they call the function, right
Anonymous functions
In PHP, it is possible to create a temporary function without specifying a name — an anonymous function. Anonymous functions: Also called closures.