I made an example to better explain the situation. If I run this
class A
{
public function __construct()
{
return new B(func_get_args());
}
}
class B
{
public function __construct()
{
var_dump(func_get_args());
}
}
$obj = new A('a', 'b', 'c');
I get
array(1) {
[0]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}
But what if the constructor prototype of B is public function __construct($var1, $va2, $var3)
? How could I pass the parameters to it if I don't know the exact numbers of parameters of the B constructor?