Codeigniter Database results - Objects or Arrays? Codeigniter Database results - Objects or Arrays? codeigniter codeigniter

Codeigniter Database results - Objects or Arrays?


I prefer objects, but there is a benefit to using arrays that can reduce clutter in situations that call for performing some check or operation on all (or some) columns:

foreach ($row as $column => $value) {   if ($value == null) {    // oh no!  null!  }}// check these columns and make sure they're non-negative$non_negative = array('amount_paid', 'income');foreach ($non_negative as $column) {  if ($row[$column] < 0) {    // less than zero?  what a bum.  }}