Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

nested for loop in php

//nested for
for (expr1; expr2; expr3) {
    for (expr1; expr2; expr3) {
        //statement;
    }
}

// EXAMPLE
for ($i = 1; $i < 5; $i++) {
    for ($j = 1; $j <= $i; $j++) {
        echo " * ";
    }
    echo '<br />';
}
 
PREVIOUS NEXT
Tagged: #nested #loop #php
ADD COMMENT
Topic
Name
4+3 =