When running a large script, (30Kb file with numerous functions) I grab all the information I will need from the database on my first connection to the database and load it all into various associative arrays.
Then, for the rest of the script, I pull the information from the arrays when I need it. (ie. $array['value-I-want']) Some of the pieces of information are referenced dozens of times so I have to keep grabbing the information from the array.
However lately I have been wondering if maybe my script would execute more quickly if I dropped the associative arrays, and just use a generic "select_value($db, $tab, $val, $whe)" function to grab the values on the fly, as opposed to pre-loading them all into the arrays.
Does anyone have any thoughts/information about which scenario is faster?
Thanks.