For example, if I have an array:
$indicators = ['open','high','low','close'];
Is it possible use these a function parameters without hardcoding them into the function?
customFunction($open,$high,$low,$close);
CodePudding user response:
You are probably looking for the spread syntax operator i.e.
customFunction(...$indicators);
CodePudding user response:
If you can't use the spread operator, you could also use call_user_func_array
:
call_user_func_array('customFunction', $indicators);