πŸš€ DevOps & SRE Certification Program πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 πŸ” Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

For Loop and Nested For Loop in PHP.

For Loop

The for loop is frequently used, when a loop is to run for a fixed number of time.

Syntax

for (initialization; test-condition; increment/decrement)
{
block of statements;
}

Sample program

<?php
for($num=1; $num<=4;$num++)
{
echo "Loop Count : $num<br>";
}
?>

Output

Nested For Loop

When a statement block of a for-loop lies completely inside the block of a new for-loop then, it is called Nested for loop.

Syntax

Sample Program

<?php
for($num=1; $num<=2;$num++)
{
echo "<b>Outer for Loop Count : $num</b><br>";
for($val=1; $val<=3;$val++)
{
echo "inner for Loop Count : $val<br>";
}
}
?>

Output

Break and Continue Statement.

Break Statement is used to stop any loop or switch Statement at any time.

Sample Program

<?php
for($num=1; $num<=10;$num++)
{
echo "Loop Count : $num<br>";
if ($num ==3)
break;
}
?>

Output

Continue Statement

This statement is used to skip the repetition of a loop.

Sample Program

<?php
for($num=1; $num<=10;$num++)
{
if ($num == 5){
echo "<br>";
continue;
}
echo "Loop Count : $num<br>";
}
?>

Output

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.