How can I call a object constructor passing an array of parameters so that having:
$array = array($param1, $param2);
I’ll be able to call
$abc = new Abc($param1, $param2);
considering that I don’t know how many parameters could be set in the array.
Is there something like call_object('Abc', array($param1, $param2))?
The best way is to use an array or object that stores the arguments and you just pass that array/object
Another way would be using Reflection ( https://www.php.net/Reflection ) using newInstanceArgs ( https://www.php.net/manual/de/reflectionclass.newinstanceargs.php )