Home > Article > Backend Development > How to pass variable parameters in php
php method of passing indefinite parameters: You can use the function [func_get_args] to implement, the code is [$args = func_get_args();for($i=0;$i
php variable parameter passing method:
Function func_get_args
, func_num_args
Can be achieved
<?php function more_args(){ $args = func_get_args(); for($i=0;$i<func_num_args();$i++){ $a = $i +1; echo "第".$a."个参数是".$args[$i]."<br>"; } } more_args('a','b','c','d','e','f'); ?>
If you want to know more about programming learning, please pay attention to the php training column!
The above is the detailed content of How to pass variable parameters in php. For more information, please follow other related articles on the PHP Chinese website!