note 94993 modified in function.call-user-func-array by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Dec 2009 16:37:55 +0000 |
| Subject: | note 94993 modified in function.call-user-func-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163670@lists.php.net to get a copy of this message | ||
If you are using PHP < 5.3 and want to call the parent class' __construct() with a variable
parameter list, use this:
<?php
public function __construct()
{
$vArgs = func_get_args(); // you can't just put func_get_args() into a function as a
parameter
call_user_func_array(array('parent', '__construct'), $vArgs);
}
?>
--was--
If you are using PHP < 5.3 and want to call the parent class' __construct() with a variable
parameter list, use this:
public function __construct()
{
$vArgs = func_get_args(); // you can't just put func_get_args() into a function as a
parameter
call_user_func_array(array('parent', '__construct'), $vArgs);
}
http://php.net/manual/en/function.call-user-func-array.php