What are the advantages and disadvantages of using numeric versus associative indexes when fetching data from a MySQL query in PHP?

When fetching data from a MySQL query in PHP, using numeric indexes is faster and more memory efficient compared to associative indexes. However, using associative indexes can make the code more readable and easier to maintain. It is important to consider the specific requirements of the project and choose the appropriate indexing method accordingly.

// Using numeric indexes
$result = mysqli_query($conn, "SELECT * FROM table");
$row = mysqli_fetch_array($result);
$value = $row[0]; // accessing data using numeric index

// Using associative indexes
$result = mysqli_query($conn, "SELECT * FROM table");
$row = mysqli_fetch_assoc($result);
$value = $row['column_name']; // accessing data using associative index