How can i get the actual name of a variable as a string. If I wanted to list the variables assigned in an object, For example
(this is not real code - just an example)
// object vars
var $bgcolor;
var $align;
function Cell($attr)
{
$this->bgcolor= $attr[0];
$this->align= $attr[1];
$msg= "<td bgcolor=$this->bgcolor align=$this->align >";
print $msg;
}
Now if I wanted to assign the name 'bgcolor' dynamically from the object variable name (such as $this->bgcolor) -- how do i do it??
I know I can create a new variable from the contents of a variable:
$var= "foo"
$$var= "goo"
echo $foo;
will print 'goo'.
But how can I get this to work :
echo "<td ",(access $this->bgcolor to return just 'bgcolor' here),"=$this->bgcolor";
Can I do this or am i dreaming???
Jimi