I'm trying to figure out the difference between $_data vs $this->_data
class ProductModel
{
var $_data = null; <--- defined here
function test()
{
$this->_data = <--- but it's accessed using $this
}
}
I know in PHP var
is used to define class properties but Why is it accessed using $this
. Shouldn't it be like $this->$_data
? What's OOP concept is being used here ? Is it a PHP specific?