You start with $i=0, then you do $a+10 and $b+5 as long as $i <5

$i=0, $a=10, $b=5

$i=1, $a=20, $b=10

$i=2, $a=30, $b=15

$i=3, $a=40, $b=20

$i=4, $a=50, $b=25

$i=5, now the loop stops because $i is no longer <5

Answer from Max on Stack Overflow
🌐
PHP
php.net › manual › en › control-structures.for.php
PHP: for - Manual
The point about the speed in loops is, that the middle and the last expression are executed EVERY time it loops. So you should try to take everything that doesn't change out of the loop. Often you use a function to check the maximum of times it should loop. Like here: <?php for ($i = 0; $i <= somewhat_calcMax(); $i++) { somewhat_doSomethingWith($i); } ?> Faster would be: <?php $maxI = somewhat_calcMax(); for ($i = 0; $i <= $maxI; $i++) { somewhat_doSomethingWith($i); } ?> And here a little trick: <?php $maxI = somewhat_calcMax(); for ($i = 0; $i <= $maxI; somewhat_doSomethingWith($i++)) ; ?> The $i gets changed after the copy for the function (post-increment).
🌐
W3Schools
w3schools.com › php › php_looping_for.asp
PHP for loop
json_decode() json_encode() json_last_error() PHP Keywords · abstract and as break callable case catch class clone const continue declare default do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends final finally fn for foreach function global if implements include include_once instanceof insteadof interface isset list namespace new or print private protected public require require_once return static switch throw trait try use var while xor yield yield from PHP Libxml
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-loops
PHP Loops - GeeksforGeeks
April 10, 2025 - In this article, we will discuss the different types of loops in PHP, their syntax, and examples. ... PHP for loop is used when you know exactly how many times you want to iterate through a block of code.
🌐
C.S. Rhymes
csrhymes.com › 2021 › 09 › 13 › the-php-for-loop.html
The PHP for loop | C.S. Rhymes
September 13, 2021 - You can loop through an existing array using a for loop if we wanted to, using $i as the array key. The for loop variable needs to be initially defined as zero as array keys begin at zero $i = 0;. We can then use php’s count() function to ...
🌐
W3Schools
w3schools.com › PHP › php_looping_foreach.asp
PHP foreach loop
json_decode() json_encode() json_last_error() PHP Keywords · abstract and as break callable case catch class clone const continue declare default do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends final finally fn for foreach function global if implements include include_once instanceof insteadof interface isset list namespace new or print private protected public require require_once return static switch throw trait try use var while xor yield yield from PHP Libxml
Find elsewhere
🌐
Udemy
blog.udemy.com › home › it & development › web development › php for loops: how to use the for loop in php
PHP FOR Loops: How to Use the FOR Loop in PHP - Udemy Blog
April 14, 2026 - An expression of code that starts when the for loop is first initiated, but never again. Continue condition. A condition evaluated each time the loop runs. If this returns true, the execution continues. If this returns false, the execution stops. Ending condition. An expression of code that runs at the end of each loop. Code block. The code that runs as each loop iteration is completed. PHP for Beginners – Become a PHP Master – CMS Project
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › php-for-loop
PHP For Loop: Introduction, Syntax, and Examples
March 5, 2026 - PHP For Loop follows a step-by-step execution process. First, the initialisation step is executed, followed by the evaluation of the condition. If the condition is found to be true, the code block is executed.
🌐
Western Illinois University
wiu.edu › news › newsrelease.php
WIU-QC to Host Graduation Celebration May 13 - WIU News
April 6, 2026 - The event will provide an opportunity for graduates to celebrate together, connect with peers and faculty and capture photos to commemorate their accomplishments. To RSVP, visit wiu.edu/commencement/qc_open_house.php. For more information, visit the Riverfront Hall front desk.
🌐
Laravel
laravel.com › docs › 13.x › structure
Directory Structure | Laravel 13.x - The clean stack for Artisans and agents
The public directory contains the index.php file, which is the entry point for all requests entering your application and configures autoloading.
🌐
Docker Hub
hub.docker.com › _ › php
php - Official Image | Docker Hub
Published image artifact details: ... file⁠ (history⁠) Source of this description: docs repo's php/ directory⁠ (history⁠) PHP is a server-side scripting language designed for ......
🌐
JetBrains
jetbrains.com › phpstorm
PhpStorm: The PHP IDE by JetBrains
June 2, 2021 - No extra installation or setup required — everything is built in. ... Whatever task you have at hand, PhpStorm brings smart coding assistance to your fingertips. With tons of useful features and shortcuts for every action, you have all the support you need to focus on what’s essential and enjoy productive PHP development.
🌐
Scientech Easy
scientecheasy.com › home › blog › for loop in php
For Loop in PHP - Scientech Easy
February 2, 2026 - A for loop uses a control variable to control how many times the block of code will execute and when it will stop. During initialization, the loop’s starting state is set. We use an assignment operator to initialize the value of loop control ...
🌐
BitDegree
bitdegree.org › learn › php-for-loop
All About PHP For Loop: Learn PHP For & PHP Foreach Loops
August 8, 2017 - Understanding what each element stands for makes it easier to commit the syntax rules to your memory. Let's break them down to understand how to use PHP for loop even better: ... test: Checks the specified condition with every loop. If it is true, the loop continues. If it proves False, the loop stops. increment: Changes the value of iterator with every loop.
🌐
Lucidar
lucidar.me › en › web-dev-class › lesson-4-09-php-loops
Lesson 4.9. PHP loops | Lulu's blog
September 17, 2022 - foreach ($array as $key => $value) echo $key . ' in written ' . $value.'<br>'; ... Write a PHP script that display the $_SERVER variable in a HTML table.
🌐
DEV Community
dev.to › chrisrhymes › the-php-for-loop-47ch
The PHP for loop - DEV Community
September 13, 2021 - The PHP for loop allows you to loop a defined number of times, until a defined condition is no longer true. for ($i = 0; $i < 10; $i++) { echo $i; } // 0123456789 ... You can also break out of a for loop using the break keyword.
🌐
NYSLRS
web.osc.state.ny.us › retire › sign-in.php
Retirement Online Sign In | NYSLRS | Office of the New York State Comptroller
Access Retirement Online. Members, retirees and beneficiaries can sign in to personal accounts. Employers can sign in to do business with NYSLRS.