How to get no of arguments passed to a PHP Function?

Member

dion.waelchi

by dion.waelchi , in category: Technology , a month ago

How to get no of arguments passed to a PHP Function?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by trycia.jones , a month ago

func_get_args() function is used to get number of arguments passed in a PHP function.


Sample Usage:

1
2
3
4
5
6
function foo() {
   return  func_get_args();
}
echo foo(1,5,7,3);//output 4;
echo foo(a,b);//output 2;
echo foo();//output 0;