I can write classes which do the exact same thing two different ways;
class Simple {
private $var;
public function __construct() {
$this->var = $this->setVar();
}
private function setVar() {
return true;
}
}
Or
class Simple {
private $var;
public function __construct() {
$this->setVar();
}
private function setVar() {
$this->var = true;
}
}
When would I use one over the other? I have seen many different php applications use the two different types. But there seems no general guideline to follow, or does it even matter for that fact?