What does using a dollar sign after $this-> in PHP mean?
oop, php, syntax
Solution
It'll look up whatever the value of "k" is, and treat it as a variable name. These two samples are the same:
echo ($obj->myvar);
####
$k = "myvar";
echo ($obj->$k);
Problem
I'm a little confused by some PHP syntax I've come across. Here is an example: ``` $k = $this->_tbl_key; if( $this->$k) { $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); } else { $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); } ``` My question is basically what does `$this->$k` mean? I figured it might mean the member variable that goes by the name of whatever is in `$this->_tbl_key`, but how would that work? Is it possible to add member variables to a class at run-time?