Vidyalelo
PHP · Q11

Functions

Programming · PHP · question 11

Q11

Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

A.
func_get_argv()
B.
func_get_argc()
Answer
C.
get_argv()
D.
get_argc()

Answer: Option B

Solution

Answer: Option B
Solution:
Here is an example-
<?php
function foo()
{
      $args = func_get_args();
      foreach (k => $v)
      { 
           echo "arg".(vn";  
      }
}
foo();
/* will print nothing */
 
foo("Hello");
/* will print Hello */
 
foo("Hello","World","Bye");
/* will print Hello World Bye */
?>