Hello!

BrainTech - software solutions, web design and applications.

Contact

Module 2 – PHP Fundamentals Lesson

For Loop

Counter-based iteration

for ($i = 0; $i < $n; $i++) is ideal when you know the number of iterations. Use it for ordered tables, pagination, and generating HTML elements. Watch for off-by-one errors at the boundary.

Pagination

OFFSET in SQL is often calculated as ($strana - 1) * $poStrani in a for or while context.

<?php
for ($i = 1; $i <= 5; $i++) {
    echo "<p>Stavka {$i}</p>";
}

Example variation

Extend the lesson example: add another variable, change the loop boundary or branching, and observe the output. Deliberately introduce an error (e.g. an undefined variable) to see the PHP message – then fix it.

Design Wireframe
High Fidelity Design
Design development
Design development
Design development
Research development