Home > Article > Backend Development > How to get function parameters in php
How to obtain function parameters in php: You can obtain them through the func_get_args() function. The function syntax is: [func_get_args(void)]. The array_get_args() function can obtain an array of function parameter lists.
func_get_args() Function: Get an array of function parameter lists.
(Recommended tutorial: php graphic tutorial)
Function syntax:
array func_get_args ( void )
Code implementation:
<?php function demo () { $args = func_get_args(); echo "传入的参数分别为:"; var_dump($args); } demo ( 'a' , 'b' , 'c' );
(Video tutorial recommendation: php video tutorial)
Run result:
传入的参数分别为: array (size=3) 0 => string 'a' (length=1) 1 => string 'b' (length=1) 2 => string 'c' (length=1)
The above is the detailed content of How to get function parameters in php. For more information, please follow other related articles on the PHP Chinese website!