Skip to content

Instantly share code, notes, and snippets.

View arsenanai's full-sized avatar

Arsen Anay arsenanai

  • Kazakhstan
View GitHub Profile
@arsenanai
arsenanai / answers.md
Created July 9, 2026 11:48
Rebilly coding exam answers — sandbox test files

Answers from Arsen Anay

Question 1: fetching DB results

fetchAll() loads everything into memory at once. If your table has millions of rows, PHP runs out of memory and you get the fatal error.

With fetch() in a loop you only keep one row in memory at a time. Stays low no matter how big the table gets.

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