好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php 不定参数如何传递

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 不定参数如何传递的详细内容!

查看更多关于php 不定参数如何传递的详细内容...

  阅读:54次