note 11887 added to function.call-user-func.php
| From: | dayiogluNOSPAM at metu dot edu dot tr dot NOSPAM | Date: | Mon, 12 Mar 2001 08:03:18 +0000 |
| Subject: | note 11887 added to function.call-user-func.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12288@lists.php.net to get a copy of this message | ||
Happily call_user_func can now call
methods of some existing objects; added
to the CVS Fri Mar 9 18:09:26 2001 EDT.
Below is an example:
<?php
class provider {
function myfunction($x) {
echo "burak was at $x\n";
}
}
class dispatcher {
function process($p2,$p3) {
call_user_func($p2, $p3);
}
}
function independent()
{
echo "just a test";
}
$x= new provider();
$y= new dispatcher();
$y->process(array($x,'myfunction'),"conference");
$y->process(independent,"");
?>
http://www.php.net/manual/en/function.call-user-func.php