mrgrammar;10967197 wrote:What is the benefit of using mysql_fetch_assoc over mysql_fetch_array?
While [man]mysql_fetch_array/man has a couple of different options when it comes to the indexing of the array, the main difference (assuming most people use associative indexes) can be seen here:
mysql_fetch_array($foo, MYSQL_ASSOC) // 36 characters
mysql_fetch_assoc($foo) // 23 characters
In other words: less typing. 🙂
EDIT: Forgot to point out that both are part of the older/deprecated [man]mysql[/man] library. If you were using [man]MySQLi[/man], you could get it even shorter:
$foo->fetch_assoc() // 19 characters
:p