note 41087 added to function.call-user-func
| From: | arjini at mac dot com | Date: | Mon, 29 Mar 2004 22:04:52 +0000 |
| Subject: | note 41087 added to function.call-user-func | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67346@lists.php.net to get a copy of this message | ||
Some of the wierder examples below confused me, and made me think that the following would work (but
it does!).
<?
class barber{
function shop($one,$two,$three,$four='quartet'){
echo $one.','.$two.','.$three.','.$four;
}
}
$bsq = new barber;
call_user_func(array(&$bsq,'shop'),'one','two','three');
/* Output = one,two,three,quartet */
class bigBarber{
var $quartet;
function bigBarber(){
$this->quartet = 'four';
}
function shop($one,$two,$three,$five='quintet'){
echo
$one.','.$two.','.$three.','.$this->quartet.','.$five;
}
}
$bbsq = new bigBarber();
call_user_func(array(&$bbsq,'shop'),'one','two','three');
/* Output = one,two,three,four,quintet */
?>
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41087
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41087&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41087&report=yes
Search -- http://master.php.net/manage/user-notes.php