You can set parameters for a function, or leave it empty. 1. When the php function sets the form parameter, but the real parameter is not given when the reference is made, the following is the case: 1! DOCTYPEhtmlPUBLIC-W3CDTDXHTML1.0TransitionalENwww.w3.orgTRxhtml1DTDxhtml1-transitional.dtd2htmlxmlnswww
You can set parameters for a function, or leave it empty. 1. When the php function sets the form parameter, but the real parameter is not given when the reference is made, the following is the case: 1! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" 2 html xmlns = "http: // www
You can set parameters for a function, or leave it empty.
1. When the php function sets the form parameter, but the reference is not given, as shown below:
1234
5Php function testing67 89
2324
Result:
1 Warning: Missing argument 1 for asd(), called in F:\phpfind\WWW\ceshi.php on line 19 and defined in F:\phpfind\WWW\ceshi.php on line 15 2 3 Warning: Missing argument 2 for asd(), called in F:\phpfind\WWW\ceshi.php on line 19 and defined in F:\phpfind\WWW\ceshi.php on line 15 4 5 Warning: Missing argument 3 for asd(), called in F:\phpfind\WWW\ceshi.php on line 19 and defined in F:\phpfind\WWW\ceshi.php on line 15 6 7 Notice: Undefined variable: b in F:\phpfind\WWW\ceshi.php on line 16 8 9 Notice: Undefined variable: a in F:\phpfind\WWW\ceshi.php on line 1610 11 Notice: Undefined variable: c in F:\phpfind\WWW\ceshi.php on line 1612 0
Conclusion: an error is reported, but the results can also be displayed. 0.
2. The function has a form parameter. When referenced, the first real parameter is not separated by commas (,), which is followed by the real parameter. The syntax is incorrect. This method is not supported in PHP. If you want to do this, you can give NULL. Example:
1234
5Php function testing67 89
2324
Result:
1 10
3. Now the default parameters are set for the test parameters, as shown in the following figure:
1234
5Php function testing67 89
2324
Result:
1 15
Conclusion: if there is a default parameter, the real parameter can be left empty. The real parameters are ordered by the form parameters. If the parameter contains the default parameter, the real parameter does not provide the corresponding parameter. The function is calculated by default parameters.
4. Let's look at another situation. In this case, the default parameters are set in the middle of the three parameters. If two real parameters are given, what is the situation.
1234
5Php function testing67 89
2324
Result:
1 Warning: Missing argument 3 for asd(), called in F:\phpfind\WWW\ceshi.php on line 19 and defined in F:\phpfind\WWW\ceshi.php on line 152 3 Notice: Undefined variable: c in F:\phpfind\WWW\ceshi.php on line 164 17
Conclusion: When a function is referenced, the order of real parameters is one-to-one. If no default parameter is specified, an error is returned if no real parameter is specified. If a default parameter is placed behind the parameter group of the function, this parameter will not be omitted and the function will participate in the operation according to the default parameter.