note 73105 modified in function.call-user-func-array by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Jul 2008 20:56:30 +0000 |
| Subject: | note 73105 modified in function.call-user-func-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141734@lists.php.net to get a copy of this message | ||
Regarding the comments below about calling parent constructors:
PHP5 with E_STRICT no longer allows calls as below:
<?php
// Causes an error with E_STRICT
call_user_func_array(array('parent', '__construct'), $args);
?>
It gives an error because you are trying to call a nonstatic function as if it was static. The
correct syntax is
<?php
// Works fine
call_user_func_array(array($this, 'parent::__construct'), $args);
?>
--was--
Regarding the comments below about calling parent constructors:
PHP5 with E_STRICT no longer allows calls as below:
<?
// Causes an error with E_STRICT
call_user_func_array(array('parent', '__construct'), $args);
?>
It gives an error because you are trying to call a nonstatic function as if it was static. The
correct syntax is
<?
// Works fine
call_user_func_array(array($this, 'parent::__construct'), $args);
?>
http://php.net/manual/en/function.call-user-func-array.php