i have a question about PHP performance. I'm using my class methods very often in one instance. For example i have method for calculation a starting time of production shift. Calculation can be used just once, because for all calculations is the same start time.
Analysis tool: xdebug (this function is called mostly and takes longest time)
What is best way how to perform script? I dont wanna make a lot of static (about 20) variables.. Or best way is using static functions for this case?
Now for very often called functions im using:
class test{ private $data; public function __construct () { $this->data=0; } public function foo() { if($this->data === 0) { // some code $this->data=$result; } return $this->data; } } I think this isnt good way how to solve my problem. Thanks you for your time.