LooieENG Posted October 17, 2008 Share Posted October 17, 2008 ^^^^^ Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/ Share on other sites More sharing options...
.josh Posted October 17, 2008 Share Posted October 17, 2008 fetch_assoc only fetches associative array. fetch_array fetches both associative and numerical. Stands to reason fetch_assoc is faster. Could do a test to find out tho... Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668354 Share on other sites More sharing options...
Barand Posted October 17, 2008 Share Posted October 17, 2008 I agree. My money's on assoc (unless you want to include fetch_row - faster still). fetch_array loads all values twice by default unless you specify second arg. Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668355 Share on other sites More sharing options...
.josh Posted October 17, 2008 Share Posted October 17, 2008 I'd like to mention though that the manual's notes do point out that there is not a significant decrease in performance, while at the same time, it provides significant added value. Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668357 Share on other sites More sharing options...
LooieENG Posted October 17, 2008 Author Share Posted October 17, 2008 Thanks for the answers, just ran a quick test then and assoc is infact faster. Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668363 Share on other sites More sharing options...
LooieENG Posted October 17, 2008 Author Share Posted October 17, 2008 Oh. Is it also true that readfile() is faster than include()? I thought readfile() just returned the number of characters in the file Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668371 Share on other sites More sharing options...
.josh Posted October 17, 2008 Share Posted October 17, 2008 I was under the impression that readfile is used for including static files etc.. like for streaming mp3's or outputting a gif or something, while include is used for dynamic files (scripts). I think they can be used interchangeably in certain situations, but still... anyways, for a straight speed test, I found this: http://www.raditha.com/wiki/Readfile_vs_include Quote Link to comment https://forums.phpfreaks.com/topic/128912-mysql_fetch_array-or-mysql_fetch_assoc-which-is-faster/#findComment-668374 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.