MrAdam Posted June 2, 2010 Share Posted June 2, 2010 Hey guys.I was just wondering if anyone could tell me the best method of converting an array of values into function parameters? I've come across this problem before when I was working with an object factory, and kept meaning to find out. I've had a look on Google but couldn't really find anything.So as an example: callFunction('myfunction', array('param1', 'param2')); function myfunction($param1, $param2){ // ...} How would I process that array and populate the function call?Thank you for any help you can give. Link to comment Share on other sites More sharing options...
Synook Posted June 2, 2010 Share Posted June 2, 2010 Such a function is known as an apply function - PHP's implementation is defined as call_user_func_array(). Link to comment Share on other sites More sharing options...
MrAdam Posted June 2, 2010 Author Share Posted June 2, 2010 Ahh perfect, cheers! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.