PHP: How to Pass child class __construct() arguments to parent::__construct()?

Solution 1:

This can be done in PHP >= 5.6 without call_user_func_array() by using the ... (splat) operator:

public function __construct()
{
    parent::__construct(...func_get_args());
}

Solution 2:

There is something like this in php, though a bit verbose:

$args = func_get_args();
call_user_func_array(array($this, 'parent::__construct'), $args);

Solution 3:

if you get php nested limit error, try this:

$args = func_get_args();
call_user_func_array(array('parent', '__construct'), $args);