Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Roman Loops

By Stephen Rees-Carter

<?php

for($i = 0; $i < 10; ++$i) {
    for($ii = 0; $ii < 10; ++$ii) {
        for($iii = 0; $iii < 10; ++$iii) {
            for($iv = 0; $iv < 10; ++$iv) {
                for($v = 0; $v < 10; ++$v) {
                }
            }
        }
    }
}

If the classic variable with a for() loop is $i, then nested loop should use $ii, then $iii, $iv, $v.

See Also

PHP Features

Last updated: 10 September 2026