<?php
class Parent {
protected $var;
public function setVar($value) {
$this->var = $value;
}
}
$parent = new Parent();
$parent->setVar('asdad');
class Child extends Parent {
public function getVar($value) {
return $this->var; //null
}
}
<?php
class Parent {
protected $var;
public function setVar($value) {
$this->var = $value;
}
}
class Child extends Parent {
public function getVar() {
return $this->var;
}
}
$child = new Child();
$child->setVar('asdad');
var_dump($child->getVar());