The PHP function variable argument list can be implemented by the three functions of _get_args (), Func_num_args (), Func_get_arg (). We have described this in more detail below.
AD:2014WOT Global Software Technology Summit Beijing Station course video release
Perhaps for the PHP junior programmer, the PHP function is not fully proficient in mastering. Today we introduce to you the PHP function variable parameter list is mainly implemented using the Func_get_args (), Func_num_args (), Func_get_arg () Three system functions, wherein the Func_get_args () The function obtains a list of parameters in the form of an array, as specified in the manual.
- Teach you to quickly implement PHP full-site permission verification
- PHP garbage collection mechanism prevents memory overflow
- Tips for sharing PHP performance optimizations
- php function Isset () can only be used for variables
- Quickly learn PHP encryption and decryption skills
The PHP function variable argument list code is as follows:
- < php
- /**
- * Implementation of multi-parameter list of functions
- *
- */
- function Multiargs ()
- {
- /** returns the list of parameters as an array */
- $args = Func_get_args();
- Number of/** parameters */
- $args_num = Func_num_args();
- foreach ($args as $key => $value)
- {
- Echo ' This is ', $key +1, ' th argument: ', $value, '<br/>';
- }
- Echo ' number of args is ', $args _num;
- }
- Multiargs (' One ', ' one ', ' one ', ' three ');
- /** Output */
- /**
- This is 1th Argument:one
- This is 2th Argument:two
- This is 3th argument:three
- Number of args is 3
- */
- ?>
The above is the implementation method of the variable parameter list of PHP function.
Introduction to the concrete implementation method of variable parameter list of PHP function