Hi, I've been using OOP in PHP for a while now, but for some reason am having a total brain meltdown and can't work out what's going wrong here!
I have a much more complex class, but wrote a simpler one to test it, and even this isn't working...
Can anyone tell me what I'm doing wrong?
class test
{
public $testvar;
function __construct()
{
$this->testvar = 1;
}
}
class test2 extends test
{
function __construct()
{
echo $this->testvar;
}
}
$test = new test;
$test2 = new test2;
All I'm trying to do is pass a variable from the parent class to the child class! I swear in the past I've just used $this->varName to get $varName in the extension??
Thanks!