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');
?>

 执行结果

原文地址:https://www.cnblogs.com/sch01ar/p/8047101.html