You know how PHP’s isset() can accept multiple (no limit either) arguments?
Like I can do:
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it?
func_get_argswill do what you want:You can also use
func_get_argto get a specific parameter (it’s zero-indexed):But be careful to check that you have that parameter:
You can even mix together
func_*_argand regular parameters:But before using it, think about whether you really want to have indefinite parameters. Would an array not suffice?