Can a PHP function accept an unlimited number of parameters? [duplicate]
In PHP, use the function func_get_args to get all passed arguments. <?php function myfunc(){ $args = func_get_args(); foreach ($args as $arg) echo $arg.”/n”; } myfunc(‘hello’, ‘world’, ‘.’); ?> An alternative is to pass an array of variables to your function, so you don’t have to work with things like $arg[2]; and instead can use $args[‘myvar’]; … Read more