1

I am calling the key() function multiple times in my code to get a value out of an array (I am using defined constants in a central file, like an application config file, which other files include).

Due to the fact I am calling key() multiple times in the same file/code I was thinking if it makes more sense to assign corresponding result once to a variable and use this one further down in the code.

I similar discussion was held for c++ (Function calls vs. local variables), but how about php7 ?

What is your experience with regards to performance and required resource ?

Community
  • 1
  • 1
formatter
  • 39
  • 4

0 Answers0