Welcome Guest, Not a member yet? Register   Sign In
result() vs. result_array() ?
#11

Well, first and foremost , it's your personal choice if you are building app yourself.

Here is a scenario!

Let's suppose you are using some API which requires data in array or object? You will find these functions very useful.
Reply
#12

Use result_array() for better performance. Array is faster than object. I benchmarked two method and got result() execution time is bigger than result_array()
The largest Bengali tutorial site on Web Development in this planet
Reply
#13

(04-21-2015, 12:45 AM)rejoan Wrote: Use result_array() for better performance. Array is faster than object. I benchmarked two method and got result() execution time is bigger than result_array()

It may be faster in one case, but then it is also slower in others ... That depends on the driver, result size and PHP version being used.

As I said, there's no practical difference.
Reply
#14

i read all comments and none give the exact difference between them.
result()  it hold object and cant process more data lets say 37k data but result_array() easily it can. the merrory allocation depend on the server configuration. So remember it.
Reply
#15

result() returns an object $this->title

result_array() returns an associated array data['title']


SEE:

CodeIgniter User Guide - Generating Query Results
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB