·
func_num_args => it returns how much
arguments are there in the function.
·
func_get_arg => it returns the Nth arguments
you passed into the function it starts from
0.
·
func_get_args => It returns all the arguments
in array.
func_num_args
|
func_get_arg
|
func_get_args
|
<?php
|
<?php
|
<?php
|
function fun1()
|
function fun2()
|
function fun3()
|
{
|
{
|
{
|
$num = func_num_args();
|
$num = func_num_args();
|
$num = func_num_args();
|
echo "Number of
|
echo " Argument 1 is
=>".
|
$args = func_get_args();
|
Arguments You Passed =>
|
func_get_arg(0)";
|
for($i=0;$i<$num;$i++)
{
|
".$num ;
|
}
|
echo "Argument $i is
=>".
|
}
|
fun2(89765,'xyz',99,0);
|
$args[$i]
."<br/>";
|
fun1(8,'abcd', 99,'null');
|
?>
|
} }
|
?>
|
|
fun3(2,'b',9);
|
|
|
?>
|
Output:
|
Output:
|
Output:
|
Number of Arguments You
|
" Argument 1 is
=>89765
|
Argument 0 is =>2
|
Passed =>4
|
|
Argument 1 is =>b
|
|
|
Argument 2 is =>9
|
No comments:
Post a Comment