What are the potential pitfalls of using array_map to handle query results with multiple rows in PHP?

Using array_map to handle query results with multiple rows in PHP can be inefficient and may result in performance issues when dealing with large datasets. Instead, it is recommended to use a loop to iterate over the query results and process each row individually.

// Fetch query results
$query = "SELECT * FROM table";
$results = $pdo->query($query);

// Process each row individually
foreach ($results as $row) {
    // Do something with $row
}