Pass arguments from array in php to constructor [duplicate]
You can use the Reflection API:
ReflectionClass::newInstanceArgs
— Creates a new class instance from given arguments.
Example:
$reflector = new ReflectionClass('Foo');$foo = $reflector->newInstanceArgs(array('foo', 'bar'));