I need to instantiate an object of a specific class type, but dynamically and with variable number of arguments. Essentially, I want a framework method that is similar to call_user_func_array()
:
https://www.php.net/manual/en/function.call-user-func.php
But I want the arguments to be for a constructor, not a function.
So, instead of doing this:
$object = new MyClass(a, b, c);
...I want to be doing this:
$object = call_constructor_array('MyClass', array(a, b, c));
Is this possible?