When returning things from the database, by default Codeigniter methods return objects (i.e. $this->db->result()
vs $this->db->result_array()
, and the same for row/row_array).
I'm a developer by sheer interest, not education, so excuse me if this is a stupid question, but what does it matter which it returns, and why does the preference - based on the naming convention - seem to prefer objects over arrays, when from what I can tell php developers love arrays?
I did some background reading, and it seems like with PHP 5+, the execution difference on arrays vs objects is negligible. So far the only difference I've come across is ->
as opposed to []
.
This question likely isn't specific to Codeigniter, but that's my frame of reference.