Hi! I have a question regarding a problem I've faced dealing with object oriented PHP. I'm used to always return a value after a method has been executed and then use the returned value in other methods. But that's because I've always done that in procedural programming. So I wonder if it's normal practice to instead use the properties of the class and use $this to retrieve those values in the different methods instead of passing them as parameters? What is best and how should I do?
code example. This:
class example {
function __construct($param){
$result = $this->foo($param);
$result2 = $this->bar($result);
...
}
function foo($param) ...
function bar($param) ...
}
or this:
class example {
var $prop;
function __construct($param){
$this->prop = $param;
$this->foo();
$this->bar();
...
}
function foo() ...
function bar() ...
}
Do you understand my example? :)