Hi everyone and Merry Christmas!
I am having some trouble with efficiency and I am hoping the StackOverflow community can help me.
In one of my (static) classes, I have a function that takes a large amount of information from my database, parses that information and puts it in a formatted array. Many functions within this class rely on that formatted array and throughout the class, I call it several times, which means that the application goes through this processes several times in a single run, which I am assuming is not very efficient. So I am wondering if there is a more efficient way I can go about doing this. Is there a way for me to store the formatted array within the static function so that I do not have to re-do the entire process every time I need information from the formatted array?
private static function makeArray(){
// grab information from database and format array here
return $array;
}
public static function doSomething(){
$data = self::makeArray();
return $data->stuff;
}
public static function doSomethingElse(){
$data = self::makeArray();
return $data->stuff->moreStuff;
}