Mysqli fetch_assoc vs fetch_array

It’s all about performance

fetch_array() returns one array with both numeric keys, and associative strings (column names), so here you can either use $row['column_name'] or $row[0]

Where as fetch_assoc() will return string indexed key array and no numeric array so you won’t have an option here of using numeric keys like $row[0].

So the latter one is better in performance compared to fetch_array() and obviously using named indexes is far better compared to numeric indexes.

Leave a Comment