Im curious about getting an answer for a OOP question but can't find any info so far.
Here goes, writing classes and methods is it faster to pass in parameters for each method or use instance/field variables and $this->x;
Which would be faster at run time?
class ExampleByParameter(){
function SomeMethod($a,$b){
echo $a." ".$b;
return;
}
}
or
class ExampleByInstance(){
function __construct($a,$b){
$this->a=$a;
$this->b=$b;
}
function SomeMehtod(){
$a=$this->a;
$b=$this->b;
echo $a." ".$b;
return;
}
}
I would imagine their would be no difference with the examples above but im thinking there might be a significant difference with more complicated code.