title: Declare order to show foreach output with PHP
body: <p>I am currently trying to set up a custom sortable list. Without getting into too much detail as this would become a very large post, I would like to use the PHP foreach function to show the list.</p>
  
  <p>I currently have </p>
  
  <pre><code>$video_id = $row['videos'];
    $res = preg_replace("/[^0-9,.]/", "",$video_id);
  $exclude = explode(',', $res);
  } ?&gt;
  
  ....
  
  &lt;ul id="sortable2" class="connectedSortable"&gt;
  &lt;?php foreach ($video_list as $key =&gt; $item): ?&gt;
  &lt;?php if(in_array($item['id'], $exclude)){ ?&gt;
  &lt;li id="video-&lt;?php echo $item['id'] ?&gt;"&gt;&lt;?php echo $item['id'], 
  $item['title'] ?&gt;&lt;/li&gt;
  &lt;?php } ?&gt;
  &lt;?php endforeach; ?&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>This generates a list of items from the database excluding items with an ID from an array which is also fetched from another table.</p>
  
  <p><img src="https://i.stack.imgur.com/v9Ewr.png" alt="Screenshot of database"></p>
  
  <p><img src="https://i.stack.imgur.com/nsSkq.png" alt="Screenshot of ID&#39;s to be excluded."></p>
  
  <p>In this example, it will only show videos with the id 3,4 and 2. This is all working as expected. My issue is once I have reordered the items and refreshed the page they are loaded in numerical order. I need these to be load in the order specified (3,4 and 2 for this example).</p>
  
  <p>Any help would be highly appreciated.</p>
  
  <p>Thanks</p>