Nove Posted September 15, 2006 Share Posted September 15, 2006 Here's a mockup I've tried to be able to set functions of a class when the object is constructed. I'm not really sure how to go about this, but from what I've made you should get the idea that I want to set f and g to functions. How can I do this?[code]function clarence() { echo "clarence!";}function marla() { echo "marla!";}class functioner { function __construct(&$v, &$b) { $this->f = $v(); $this->g = $b(); }}$c = new functioner(clarence, marla);$c->t = "5";echo $c->t;$c->f();$c->g();[/code] Link to comment https://forums.phpfreaks.com/topic/20918-class-variables-as-functions/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.