标签:
int func_num_args ( void )
<?php function demo () { $numargs = func_num_args (); echo "参数个数为: $numargs \n" ; } demo ( ‘a‘ , ‘b‘ , ‘c‘ );
参数个数为: 3
array func_get_args ( void )
<?php function demo () { $args = func_get_args(); echo "传入的参数分别为:"; var_dump($args); } demo ( ‘a‘ , ‘b‘ , ‘c‘ );
运行结果
传入的参数分别为: array (size=3) 0 => string ‘a‘ (length=1) 1 => string ‘b‘ (length=1) 2 => string ‘c‘ (length=1)
mixed func_get_arg ( int $arg_num )
<?php function demo () { $numargs = func_num_args (); echo "参数个数为: $numargs <br />" ; $args = func_get_args(); if ( $numargs >= 2 ) { echo "第二个参数为: " . func_get_arg ( 1 ) . "<br />" ; } } demo ( ‘a‘ , ‘b‘ , ‘c‘ );
参数个数为: 3 第二个参数为: b
标签:
原文地址:http://www.cnblogs.com/chenqionghe/p/4817275.html