title: Can you force PHP to view a numeric key as an associative array key?
body: <p>Having an odd problem with an associative array.  This code:</p>
  
  <pre><code>$sql = DB::select('id','process_id')-&gt;from('field')-&gt;order_by('process_id')-&gt;order_by('sort_order');
  $query = $sql-&gt;execute();
  
  foreach($query-&gt;as_array() as $row){
      $results[$row['id']] = $this-&gt;get_field($row['id']);
  }      
  </code></pre>
  
  <p>creates an array with a numeric key.  In my development environment the array is treated as an associative array and is ordered exactly as it's built from the query.  However, in production it's treating the key as a number and sorting according to the ID.  If I force PHP to consider the key associative by:</p>
  
  <pre><code>$results["a".$row['id']] = $this-&gt;get_field($row['id']);
  </code></pre>
  
  <p>it uses the MySQL sort.  Unfortunately though there's a lot of code in place that depends on the key just being the ID.</p>
  
  <p>Does anyone have any thoughts on why there might be a difference between servers?  Any ideas for a workaround?  </p>