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

猜你喜欢

转载自www.cnblogs.com/jjxhp/p/11972117.html