I read a lot about how evil global variables are in PHP, but I am trying to optimize a code I am writing. In this webapp a lot of functions are using the same data (about up to 50 items at once) to perform numerous operations and the data itself is stored in a database.
I have two options which are a) fetching data from the database EVERY TIME a function needs it or b) fetching the data ONCE and storing it in (a) global variable(s).
When it comes to performance, which option is the best ?