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
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
06:57
PHP for loops explained - YouTube
04:47
For Loop in PHP | PHP Tutorial For Beginners - YouTube
05:19
31 PHP Tutorial FOR loop in PHP - YouTube
07:10
Lesson 21 | PHP for Beginners: For Loop Explained with Examples ...
18:04
PHP Loops Explained Episode 4 with Examples | For, While, Do While, ...
05:09
Les bases de PHP: la boucle for - YouTube
Top answer 1 of 6
2
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
2 of 6
1
Your loop runs five times. Each time through the loop you add 10 to the value of $a. Doing that five times gives you 50.
Codecademy
codecademy.com › learn › learn-php › modules › php-loops › cheatsheet
Learn PHP: Loops in PHP Cheatsheet | Codecademy
In PHP, a for loop is commonly used to execute a code block a specific number of times.
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
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
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.
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.
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.