title: Variables / Functions and PHP Logic
body: <p>This may sound like a dumb question, but does assigning a variable to a function mean it only calls the function ONE time, and can be reused unlimited times without making an additional call to the function or does it still call the function multiple times?</p>
  
  <p><strong>is this:</strong></p>
  
  <pre><code>$variable = function_name();
  echo $variable;
  echo $variable;
  </code></pre>
  
  <p><strong>the same as this:</strong></p>
  
  <pre><code>echo function_name();
  echo function_name();
  </code></pre>
  
  <p>I understand both situations are ultimately displaying the same bit of information, but I'm curious if that bit of data is fetched one time and reused many, or if it's fetched upon each echo.</p>
  
  <p>So does assigning a variable to a function mean <code>function_name();</code> does the work only ONE time and the variable just recycles the data for later usage or does <code>function_name();</code> actually do the work TWO times?</p>
  
  <p>Is it better practice to assign variables or just directly call the function each time it needs to be used?</p>