note 10113 added to create_function
| From: | koyama at hoge dot org | Date: | Thu, 14 Dec 2000 09:22:23 +0000 |
| Subject: | note 10113 added to create_function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8721@lists.php.net to get a copy of this message | ||
HOw to use function which is created by create_function() as class method?
I try:
class Hoge {
var $lamda;
function set( $lamda ) {
$this->lamda = $lamda;
}
function callLamda() {
$func = $this->lamda;
return $func();
}
}
$newfunc = create_function( '', 'echo "hoge<br>\n";' );
$h = new Hoge;
$h->set( $newfunc );
$h->callLamda();
It works fine. :-)
http://www.php.net/manual/function.create-function.php