I see comparisons between mysqli_fetch_array()
and mysqli_fetch_all()
that say that with mysqli_fetch_all()
it will take more memory a
From PHP's page on mysql_fetch_all():
I tested using
fetch_all
versuswhile
/fetch_array
and:
fetch_all
uses less memory (but not for so much).In my case (test1 and test2): 147008,262848 bytes (
fetch_all
) versus 147112,262888 bytes (fetch_array
&while
).So, about the memory, in both cases are the same.
However, about the performance:
My test takes :350ms (worst case) using
fetch_all
, while it takes 464ms (worst case) usingfetch_array
, or about 35% worst usingfetch_array
and awhile
cycle.So, using
fetch_all
, for a normal code that returns a moderate amount of information is:a. cleaner (a single line of code)
b. uses less memory (about 0.01% less)
c. faster.php 5.6 32bits, windows 8.1 64bits