Php Basics: function parameters This post was last edited by php_2015 from 2015-01-2810: 45: 18 function & nbsp; run () & nbsp; {echo & nbsp; 123 ;} $ _ a & nbsp; aa; $ _ B & nbsp; bb; run ($ _ a, $ _ B); & nbsp php Basics: function parameters
This post was last edited by php_2015 on 10:45:18
Function run (){
Echo 123;
}
$ _ A = 'a ';
$ _ B = 'BB ';
Run ($ _ a, $ _ B );
// Row 3. when defining a function, the parameter is null.
// No error will be reported if any variable is written in the parameter during the call of row 6th. why?
// Is my infrastructure too poor?
------ Solution ----------------------
The number of parameters should not be less than the number of parameters without default values in the definition.
Because PHP supports variable parameter lists in user-defined functions.
You can use the func_num_args (), func_get_arg (), and func_get_args () functions to call parameters.
------ Solution ----------------------
Reference:
Should there be a warning or error prompt when the parameters in the definition are inconsistent with those in the call?
Don't take it for granted. you can check the manual or something uncertain, or write your own code for testing. practice is a good way to test the truth.
------ Solution ----------------------
No error is reported when the provided parameters are more than the ones specified by the function.
------ Solution ----------------------
Php compiler to improve encoding flexibility
If you want to learn more... look at the php source code, or even the subroutine implementation of the assembly language