Skip to content

Instantly share code, notes, and snippets.

View datopipo's full-sized avatar
🦖

david datopipo

🦖
  • Georgia
View GitHub Profile
@datopipo
datopipo / question-1.md
Created April 25, 2026 13:55
Developer Coding Exemplar

Answer 1

The memory issue is caused by fetchAll(), which loads the whole result set into memory.
Fetch and process one row at a time instead, so PHP does not need to hold the entire table in an array.

<?php

$stmt = $pdo->prepare('SELECT * FROM largeTable');
$stmt->execute();