note 10113 deleted from function.create-function by cmb
| From: | cmb@php.net | Date: | Thu, 07 Jul 2022 14:46:15 +0000 |
| Subject: | note 10113 deleted from function.create-function by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218929@lists.php.net to get a copy of this message | ||
Note Submitter: koyama at hoge dot org
----
How do you use function which is created by create_function() as class method?
<?php
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. :-)