Search code examples
phpfor-loopmnemonics

How do you remember the order of the expressions in a for loop?


It's a pretty simple question, I always have to go check here and then I hit my head and say it's so obvious. But really after a week of not using it I usually end up writing

for ($i = 1;  $i++; $i <= 10;) {
    echo $i;
} 

some Mnemonic might help


Solution

  • ICE:

    • Initialisation
    • Check
    • Execute