php 不定参数如何传递
时间:2020-09-29 09:41
php不定参数传递的方法:可以使用函数【func_get_args】实现,代码为【$args = func_get_args();for($i=0;$i<func_num_args();$i++) $a = $i +1;】。
php不定参数传递的方法:
函数func_get_args
,func_num_args
可以实现
<?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'); ?>
想了解更多编程学习,敬请关注php培训栏目!
以上就是php 不定参数如何传递的详细内容,更多请关注www.gxlsystem.com其它相关文章!