This code should help you:

<?php
i = 1; i++) {
    sum + $i;
}
echo $sum;    
?>

You are incorrect using loop.

Explanation

I think it will be easier to understand with following table:

_____________________
|JUMP | sum  |
|1    | 1    | 1     |
|2    | 2    | 3     |
|3    | 3    | 6     |
|4    | 4    | 10    |
|5    | 5    | 15    |
|6    | 6    | 21    |
|7    | 7    | 28    |
|8    | 8    | 36    |
|9    | 9    | 45    |
|10   | 10   | 55    |

More about for you can read in PHP: for

Update

If you want your structure it can be as follows:

<?php
str = '';
for(i<=10; $i++) {
    $sum = i;
    i == 10 ? i." + ";
}
echo sum;
?>

And it will output 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Answer from Karol Gasienica on Stack Overflow
🌐
PHP
php.net › manual › en › control-structures.for.php
PHP: for - Manual
<?php for ($i = 1; $i <= 10; $i++) { echo $i . " "; } ... Of course, the first example appears to be the nicest one (or perhaps the fourth), but you may find that being able to use empty expressions in for loops comes in handy in many occasions.
🌐
W3Schools
w3schools.com › php › php_looping_for.asp
PHP for loop
The for loop is used when you know how many times the script should run. for (initialization; condition; increment) { // code to be executed } ... increment - is evaluated after each iteration (typically used to increase/decrease the counter ...
🌐
W3Resource
w3resource.com › php-exercises › php-for-loop-exercise-10.php
PHP for loops Exercise: Create a table using for loop - w3resource
The outer loop (for ($row=1; $row <= 10; $row++)) controls the rows of the table, iterating from 1 to 10.
🌐
Just Academy
justacademy.co › blog-detail › 1-to-10-print-with-for-loop-program-in-php
Mastering PHP: How to Print Numbers 1 to 10 Using a For Loop
June 19, 2025 - Using a for loop in PHP to print numbers from 1 to 10 is an excellent way to understand the fundamentals of programming logic and iteration. This basic concept not only demonstrates how loops function but also highlights the efficiency of automating repetitive tasks.
🌐
Filo
askfilo.com › cbse › smart solutions › display the numbers from 1 to 10 using php.
Display the numbers from 1 to 10 using PHP.... | Filo
December 25, 2025 - <?php for (<span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.65952em;vertical-align:0em;"></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8388800000000001em;vertical-align:-0.19444em;"></span><span class="mord">1</span><span class="mpunct">;</span></span></span></span>i <= 10; i . "<br>"; } ?> ... <?ph
🌐
W3Resource
w3resource.com › php-exercises › php-for-loop-exercises.php
PHP for loop - Exercises, Practice, Solution - w3resource
March 31, 2026 - This resource offers a total of 190 PHP for loop problems for practice. It includes 38 main exercises, each accompanied by solutions, detailed explanations, and four related problems. [An Editor is available at the bottom of the page to write and execute the scripts.] ... Create a script that displays 1-2-3-4-5-6-7-8-9-10 ...
🌐
Steemit
steemit.com › world-of-xpilar › @rme › coding-practice-write-a-program-in-php-to-print-1-10-numbers-in-ascending-order-and-descending-order-by-running-for-loop
Coding Practice: Write a program in PHP to print 1-10 numbers in ascending order & descending order by running for loop — Steemit
March 8, 2026 - " "; } print "<br>"; //run a for loop to print 1-10 numbers in descending order for($i=$numbers; $i>=1; $i--) { //output numbers in descending order print $i . " "; } //end of php code ?> </body> </html> Output · 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1 · Do it yourself on online PHP compiler: ...
Find elsewhere
🌐
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
🌐
FlatCoding
flatcoding.com › home › php for loop: run code using a counter with examples
PHP For Loop: Run Code Using a Counter with Examples - FlatCoding
July 1, 2025 - ... This loop starts at 5. It runs while $i is at least 1. After each run, it subtracts 1. You see the numbers printed in reverse order. ... This loop starts at 10 and subtracts 2 each time.
🌐
Codecademy
codecademy.com › docs › php › loops
PHP | Loops | Codecademy
September 9, 2021 - Copy to clipboard · Output: the ... and immediately starts the next iteration. <?php · for ($i = 1;$i <= 10; $i++) { if ($i % 2 == 1) {continue; } echo 'iteration #' ....
🌐
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 - The end result of the code is a list of the numbers 1 through 10. You control the number of times the loop repeats through the initial counter and the counter increment.
🌐
Laracasts
laracasts.com › discuss › channels › laravel › how-to-do-a-foreach-loop-for-1-10
How to do a foreach loop for 1-10
<select name="immersiveScore" id="immersiveScore" class="form-control" required> <option value="" hidden>Choose Immersive Score</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> but this seems like the wrong way to do it if I have access to PHP.
🌐
Scientech Easy
scientecheasy.com › home › blog › for loop in php
For Loop in PHP - Scientech Easy
February 2, 2026 - ... Let’s take an example of ... = 5; echo "Multiplication Table for $num: \n"; for($i = 1; $i <= 10; $i++) { $result = $num * $i; echo "$num * $i = $result\n"; } ?>...
🌐
Scaler
scaler.com › home › topics › php-tutorial › php for loop
PHP For Loop - Scaler Topics
April 13, 2024 - Now let us see a few examples of for loops in PHP: ... In this example, we are using the range() function to create an array of numbers from 1 to 9, and then using a for each loop to iterate over the array and print each number.
🌐
Codecademy
codecademy.com › learn › learn-php › modules › php-loops › cheatsheet
Learn PHP: Loops in PHP Cheatsheet | Codecademy
In PHP, the foreach loop is used for iterating over an array. The code block is executed for every element in the array and the value of that element is available for use in the code block.
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-loops
PHP Loops - GeeksforGeeks
April 10, 2025 - PHP for loop is used when you know exactly how many times you want to iterate through a block of code. It consists of three expressions: Initialization: Sets the initial value of the loop variable. Condition: Checks if the loop should continue. Increment/Decrement: Changes the loop variable after each iteration. ... Example: Printing numbers from 1 to 5 using a for loop.
🌐
guvi.in
studytonight.com › php › php-for-and-foreach-loop
Introduction to PHP For and Foreach Loop
<?php for($a = 1; $a <= 10; $a++) { echo "$a <br/>"; } ?> Output: 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8 · 9 · 10 · We can also use a for loop inside another for loop. Here is a simple example of nested for loops.