wow, yeah.. i didnt really didnt get that from your first message =)
anyhow, here is the fix: (all that you need are brackets around the variable 'type')
<?
class foo {
var $foo = array();
var $foo2 = array();
function addel($k,$v,$type) {
$this->{$type}[$k] = $v; }
function display($type) {
print "$type: ";
print_r ($this->$type);
print "<hr>";
}
}
$f = new foo;
$f->addel('k1','v1','foo');
$f->addel('k2','v2','foo2');
$f->display('foo');
$f->display('foo2');
?>