PHP Variable from extended class
Posted
by
Ste
on Stack Overflow
See other posts from Stack Overflow
or by Ste
Published on 2011-03-07T16:01:04Z
Indexed on
2011/03/07
16:10 UTC
Read the original article
Hit count: 176
I cant retrieve var from parent class:
class core {
var $variable;
var $test;
function __construct() {}
public function setVar($var)
$this->variable = $var;
}
}
class test extends core {
public function getVar() {
return $this->variable;
//also if i echo here i can't see !!!!
}
}
$core = new core();
$core->test = new test();
print $core->test->getVar();
Any help??
© Stack Overflow or respective owner