title: Find order of data inside an array
body: <p>I have a simple array of stuff:</p>
  
  <p>$array = array("apples","oranges","strawberries");</p>
  
  <p>I am trying to find the order of the stuff inside the array. (sometimes the order changes, and so do the items)</p>
  
  <p>I'm expecting to get something like this:</p>
  
  <p>"apples" => 0,
  "oranges => 1,
  "strawberries => 2</p>
  
  <p>The end result has something to do with database sorting.  </p>
  
  <p>Something like this, inside a foreach loop:</p>
  
  <p>UPDATE tbl SET sortorder = $neworder WHERE fruit = '$fruitname'</p>
  
  <p>The $neworder variable would be populated with the new order, inside the array. While the $fruit variable comes from the item inside the array.</p>