note 58637 added to function.call-user-func-array

From: Date: Thu, 10 Nov 2005 11:50:37 +0000
Subject: note 58637 added to function.call-user-func-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-98374@lists.php.net to get a copy of this message
Just an extra for the post of amer at o2 dot pl: If you need to call the PARENT method: call_user_func_array(array('parent', 'method'), $args); With that, if you need to call a constructor and/or add some extra code to the instantiation process: <?php function __construct() { // Get the arguments $args = func_get_args(); // Initialize parent with arguments call_user_func_array(array('parent', '__construct'), $args); // ... Your Code Here ... } ?> Note that your constructor pass all the arguments to the parent constructor and it doesn't matter how many arguments you pass. This is pretty useful for constructors with a variable number of arguments. ---- Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58637 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58637&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58637&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98374) next »