LooieENG Posted October 17, 2008 Share Posted October 17, 2008 ^^^^^ 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... 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. 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. 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. 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 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 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
Archived
This topic is now archived and is closed to further replies.