19: How to Create a For Loop in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners

How to Create a For Loop in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners. In this PHP tutorial you will learn about for loops which are often used in PHP scripts. Loops are used to loop through multiple pieces of data one at a time. Loops can help with spitting out a lot of data using little code.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful 🙂

Material for this lesson: https://www.patreon.com/posts/php-19-download-15629461


Aaron Carillo says:

from part 1 to part 19 still on progress 😀

sathesh kumar says:

easy learn thk u very simple ..keep it i support…

gaga khan says:

Can you show??
” For loop” Where and how to use in a project.

dataspecialist says:

These are great tutorials and I really appreciate them, however I think you are doing your viewers a disservice by not mentioning that a for loop can be decremented as well with

for ($x = 1; $x = 10; $x–){
//code to be executed;

MoVine says:

Dude where your from i really wanna meet you and buy u some drinks you doing great job

Eos April says:

best of the best 😉

MoVine says:



i love your toutarial and you. keep working thank you

Dan Cc says:

For Loops allow you to run through the loop when you know how many times you’d like it to run through the problem such as for (var i; i < 10; i++); this will continually increase i untill that condition returns false, any number can replace the 10 even a variable. but it will quit once the condition is no longer being met. This is best used again for loops that you know how when they should stop. While Loops allow you a little more flexability in what you put in it, and when it will stop such as while ( i < 10) you can also substitue in a boolean(true/false) for 10 as well as many other types of varibles. The key difference between the two is organization between them, if you were going to increase to 10 it'd be a lot cleaner and more readable to use a for statement, but on the other hand if you were to use an existing variable in your program in your loop parameters it'd be cleaner to just wright a while loop. In the For loop you MUST create a new variable, thats not true for the While loop. source: https://www.codecademy.com/en/forum_questions/510e3c1a3011b8fa25005255

Alexander Goncharuk says:

Hi, man
Good tutorials. One little mistake: on 1:59 you need $x+=3, not $x+3, last variant will crash the loop.

Brian Gonzales says:

beam tutorials javascript

CK 002 says:

Is it like some kind of 1<= x <= 10 which we write in algebra?

Francis Miguel says:

Hi there i’m your new subscriber and amazing ive’d enjoy watching your videos and it helps me a lot wow thank you for sharing your knowledge to us

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!