function foo()
{ echo 'function called'; }
Is it possible to do something like this:
onchange($a, foo);
$a = "foo"; // echoes 'function called'
$a = "bar"; // echoes 'function called'
Instead of:
$a = "foo";
foo(); // echoes 'function called'
$a = "bar";
foo(); // echoes 'function called'
Sort of. You can use what’s called a
setter, a function designed to set a variable.