title: Best performance: $this->var Vs $_SESSION superglobal with big arrays
body: <p>I have a method that works with array with ~30000 entries. The method can be called usually about 100 times.</p>
  
  <p>The idea is to use <code>$this-&gt;response</code> var and when the method is called another time save SQL querys...</p>
  
  <p>Example:</p>
  
  <pre><code>function myMethod(){
      $sql = "SELECT * FROM table LIMIT 30000";
              if(!isset($this-&gt;data_kpi))
                  $this-&gt;data_kpi  = myclass::myPDOmethod($sql); //array entries
  
          //rest of method use $this-&gt;data_kpi
  }
  </code></pre>
  
  <p>If I use a $_SESSION superglobal I get a best performance 6 Vs 19 seconds. I don't know why but i think is a bad practice use a superglobal for this....</p>
  
  <p>Example with superglobal:</p>
  
  <pre><code>function myMethod(){
          $sql = "SELECT * FROM table LIMIT 30000";
                  if(!isset($_SESSION['tmp']))
                      $_SESSION['tmp']  = myclass::myPDOmethod($sql); //array entries
  
              //rest of method use $_SESSION['tmp']
  }
  
   __destruct(){
      unset($_SESSION['tmp']);
      }
  </code></pre>
  
  <p>Any suggestions?</p>