title: Which is faster: in_array or database queries?
body: <p>Which is faster?</p>
  <ol>
  <li><p>I store the SQL results in an array - which means 1000 or more IDs. And then I use in_array() function 30 times to find out MyID is in the database.</p>
  </li>
  <li><p>I check MyID is in the database and repeat it 30 times.</p>
  </li>
  </ol>
  <h3>Test results:</h3>
  <pre><code>48 records (MyID)
  
  Array count: 1704 (ID) (Table size: 100 000)
  
  Delta time:
  
  Method 1: 0.0075759887695312
  
  Method 2: 0.0038831233978271
  </code></pre>