Ok, I didn’t really know how to even phrase the question, but let me explain.
Suppose I have a variable:
$file = dirname(__FILE__);
What happens if I assign $file to another variable?
$anotherVariable = $file;
Does the dirname function get executed each time I assign?
Thanks for any help.
No. PHP is imperative, so the right hand side of assignment expressions is evaluated, and the result stored “in the” left hand side (in the simple and almost ubiquitous case, the variable named on the left hand side).
This gets a little more complex when you assign by reference ($a = &$b), but we needn’t worry about that for now.