title: How should I return multiple variables in a function (for best practices)?
body: <p>Just curious to know what the best practice would be for something like this:</p>
  
  <p>A function, that returns multiple variables - how should one return these variables?</p>
  
  <p>like this (globalizing):</p>
  
  <pre><code>function myfun(){
  
  global $var1,$var2,$var3;
  
  $var1="foo";
  $var2="foo";
  $var3="foo";
  
  }//end of function
  </code></pre>
  
  <p>or like this (returning an array):</p>
  
  <pre><code>function myfun(){
  
  $var1="foo";
  $var2="foo";
  $var3="foo";
  
  $ret_var=array("var1"=&gt;$var1,"var2"=&gt;$var2,"var3"=&gt;$var3);
  
  return $ret_var;
  
  }//end of function
  </code></pre>
  
  <p>I done a performance test, and it looks like using arrays is faster (after a few refreshes):</p>
  
  <pre><code>array took: 5.9999999999505E-6
  global took: 2.0999999999938E-5
  </code></pre>
  
  <p>But I'm curious to know which method is the best practiced for a simple situation like this?</p>