Monday, May 27, 2019

PHP For Loop Control Statement !!

PHP For Loop Control Statement !!

PHP For loop control statement
PHP For Loop Control Statements in this article we will discuss about,




For Loop :


The For Loop is a one type of control statement.

For loop is used when we have to use common code for many times.

Code in the loop is executed until the limit is not end.

Syntax :

for (initialization ; condition; increment/decrement)
{
        code of the loop
}
code out of loop

Program :

Write a php program for print numbers.


Output :

0
1
2
3
4
5

as shown in above example output every number is print in a new line.
so, if we want to print the statement in a new line so we have to use <br> tag.

if we not used <br> tag then it prints all output in same line without print in new line.

Program :



Output :

012345

Nested For Loop


Nested for loop means for loop in the for loop.

Inner loop is execute n number of times for every iteration of outer loop and code of inner loop is executed n times for every iteration of inner loop.

Syntax :

for (initialization ; condition; increment/decrement)
{
     for (initialization ; condition; increment/decrement)
       {
            code of the loop
        }
}

Program :


Output :

*
**
***
****
*****

<br> uses for new line.

Break Statement With For Loop


break statement is used to terminate the loop.
in loop where we use the break statement it not execute code after break and also come out from loop.

Program :



Output :

1

Here, we print a which starts from 1. when loop start first time print a means it prints 1 after break will execute and further no process occur in for loop.

PHP For Each Loop


The PHP for each loop is used only to array.

PHP for each loop is used to traverse the elements of array.

Program :


Output :

sunday
monday
tuesday
wednesday

Here, we create an array and after that we have to take any variable and have to write as a $array name as $variable and print the value.

So, in this article we learn about for loop in php. so, keep learning!!  keep join us !! 

You Can Also Search For :


Mesothelioma Survival Rates , Mesothelioma Attorneys California , Seattle Mesothelioma Lawyer , Mesothelioma Suit , Mesothelioma Claim , Wisconsin Mesothelioma Attorney , Mesothelioma Attorney illinois , Mesothelioma Trial Attorney ,Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , New York Mesothelioma Law Firm,Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyers San Diego,Mesothelioma Litigation , Mesothelioma Attorney Assistance , Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyer Chicago , New York Mesothelioma Law Firm , 


Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , Lawsuit Mesothelioma  , Truck Accident Attorney Los Angeles ,Asbestos Exposure Lawyers  , Mesothelioma Cases  , Emergency Response Plan ppt , Mesothelioma Lawyers San Diego  , Asbestos Mesothelioma Lawsuit  , Tennessee Mesothelioma Lawyer , Meso Lawyer  , Mesothelioma Settlements Amounts  , Mesothelioma Law Firms , New Mexico Mesothelioma Lawyer , Accident Attorneys Orange County , Mesothelioma Lawsuit ,Personal Injury Accident Lawyer  , Purchase Structured Settlements  , Firm Law Mesothelioma , Car Accident Lawyers Los Angeles , Mesothelioma Attorneys , Structured Settlement Company  , Auto Accident Lawyer San Francisco  , Mesotheolima  , Los Angeles Motorcycle Accident Lawyer


Mesothelioma , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois , Mesothelioma Drug , Mesothelioma Attorney DirectoryMesothelioma Settlements , Mesothelioma Help  , Mesothelioma ct , Mesothelioma Attorney Florida , Washington Mesothelioma Attorney , Best Mesothelioma Lawyers , Diagnosed With Mesothelioma , Mesothelioma Settlement Amounts , Mesothelioma Personal Injury Lawyers , Mesothelioma Compensation , Attorney Lawyer Mesothelioma  ,Colorado Mesothelioma Lawyers,Mesothelioma Lawsuits , Mesothelioma Claims , Average Mesothelioma Settlement , Average Mesothelioma Settlement , Mesothelioma Law Suit , Alabama Mesothelioma Lawyer , alabama Mesothelioma Lawyer , utah mesothelioma lawyer , Dallas Mesothelioma Lawyer , Mesothelioma Attorney California , Mesothelioma Lawyer California ,Mesothelioma Survival Rates ,

Mesothelioma Attorneys California, Wisconsin Mesothelioma Attorney Mesotheliama , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois, Mesothelioma Trial Attorney Injury Lawyer Houston tx , Baltimore Mesothelioma Attorneys , Mesothelioma Care ,Mesothelioma Trial Attorney ,Mesothelioma Lawyer Texas , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , California Mesothelioma Attorney Philadelphia Mesothelioma Lawyer , Illinois Mesothelioma Lawyer , Mesothelioma Attorney , Mesothelioma Claims , Average Mesothelioma Settlement 
Integrated ehr , Mesothelioma Law Sui , Mesothelioma Lawyer California,Mesothelioma Attorney California ,Mesothelioma Law Suits ,Dallas Mesothelioma Attorneys ,Mesothelioma Drug ,Mesothelioma Attorney Directory