Function, all languages are available, so here only focus on:
1> definition: php does not need to define the return value type.
2> the function name is case-sensitive. However, when calling a function, it is usually defined in the same format.
3> all functions and classes in PHP are fully local, and external calls can be defined internally, and vice versa.
4> PHP does not support function overloading, and it is impossible to cancel or redefine declared functions.
5> recursive functions can be called in PHP. However, avoid calling recursive functions/methods that exceed layer 100-layer 200, because the stack may be broken to terminate the current script.
6> parameters with default values must be at the end of the parameter table.
7> variable functions. You can call a function by renaming the function.
For example:
Function helloWorld ($ name = 'php ')
{
Echo "Hello World". $ name;
}
$ Func = helloWorld;
$ Func (); // call the helloWorld Function
$ Func ('saga '); // call helloWorld with Parameters
8> variable length parameter list:
It mainly relies on three functions: func_num_args (), func_get_arg (), and func_get_args ()
Description:
Int func_num_args () returns the number of passed parameters. (PHP4, PHP5)
Mixed func_get_arg (int arg_num) returns the arg_num parameter (counted from 0)
Array func_get_args () returns the parameter expression group.