title: How big can a php array be before memory concerns should be raised?
body: <p>Our app currently works like this:</p>
  
  <pre><code>class myClass{
  
      private $names = array();
  
      function getNames($ids = array()){
           $lookup = array();
  
           foreach($ids as $id)
               if (!isset($this-&gt;names[$id]))
                  $lookup[] = $id;
  
           if(!empty($lookup)){
                $result;//query database for names where id in $lookup
                        // now contains associative array of id =&gt; name pairs
                $this-&gt;names = array_merge($this-&gt;names, $result);
           }
  
           $result = array();
           foreach($ids as $id)
               $result[$id] = $this-&gt;names[$id];
  
           return $result;
      }
  }
  </code></pre>
  
  <p>Which works fine, except it can still (and often does) result in several queries (400+ in this instance).</p>
  
  <p>So, I am thinking of simply querying the database and populating the <code>$this-&gt;names</code> array with every name from the database.</p>
  
  <p>But I am concerned about how many entries in the database I should start worrying about memory when doing this? (database column is varchar(100))</p>