title: What's the PSR-2 standard for associative array indexes (and what's the correct naming approach when pulling directly from a query)
body: <p>What's the PSR-2 standard for associative array indexes? For consistency I would assume camelCase, however consider a case like this (I'm using Laravel 4+):</p>
  
  <pre><code>// In Users table I have fields like this: favorite_color, created_at, etc...
  $id = 1;
  $rows = DB::select(DB::raw("SELECT * FROM users WHERE id=:id"),array("id"=&gt;$id));
  $row = $rows[0];
  
  return $row;    
  </code></pre>
  
  <p>Now <code>$row</code> contains array indexes with underscores (snake_case). <strong>What would you do?</strong> </p>
  
  <p>Would you NEVER let array indexes have underscores, doing the extra work needed to format them from the query? Or would you allow this only for instances where you are pulling from the database (perhaps you justify it by saying to yourself <em>"hey that's an indicator to me that came directly from a query"</em>)? Also consider that you may have other places in your application that use an index like this: <code>data['favoriteColor']</code>. And keep in mind the answer to my other question: <a href="https://stackoverflow.com/questions/23274988/in-a-laravel-eloquent-model-do-we-call-table-field-names-using-camelcase-even">In a Laravel Eloquent model, do we call table field names using camelCase, even though they contain an underscore in the db?</a></p>