Jump to content


This topic is now archived and is closed to further replies.


Class variables as functions

Recommended Posts

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;

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.