I'm fairly new to PHP.
I want to store in a variable a value which "points" to one of an object's member functions. Here's code which I thought would do the right thing. It fails with the message: "PHP Fatal error: Call to undefined function: foo() in ./foo.php on line 29" That makes sense to me, but everything I've thought of to fix it, doesn't.
Thanks ahead of time!
<?
class Frump {
var $me;
function Frump(){
$this->me[0] = "foo";
$this->me[1] = "bar";
}
function foo()
{
echo "in foo\n";
}
function bar()
{
echo "in bar\n";
}
function get_the_func($ind){
return $this->me[$ind];
}
}
$foobar = new Frump();
$thing = $foobar->get_the_func(0);
$thing();
?>