Monday 1 December 2014

For Loop in Php

Structure of the Problem Requirements 

In this problem we will discuss about for loop in Php. Loops are used to repeat the same pattern as per user requirements . But in our case we just initialize a number from 0 and tend it to 40. we have implement four for loops and in every for loops ten numbers are increases. Here is the source code of this example which help you in better understanding .


SOURCE CODE


<html>
<head>
<title>For Loops Php </title>
</head>
<body>
<?php
echo "<br />";
echo " For Loop _ 1 : ";
echo "<br />";
echo "<br />";
for ($Numbers=0; $Numbers <= 10; $Numbers++) {
echo $Numbers . ", ";
}
echo "<br />";
echo "<br />";
echo " For Loop _ 2 : ";
echo "<br />";
echo "<br />";
for ($Numbers=10; $Numbers <= 20; $Numbers++) {
echo $Numbers . ", ";
}
echo "<br />";
echo "<br />";
echo " For Loop _ 3 : ";
echo "<br />";
echo "<br />";
for ($Numbers=20; $Numbers <= 30; $Numbers++) {
echo $Numbers . ", ";
}
   echo "<br />";
echo "<br />";
echo " For Loop _ 4 : ";
echo "<br />";
echo "<br />";
for ($Numbers=30; $Numbers <= 40; $Numbers++) {
echo $Numbers . ", ";
}
?>
</body>
</html>

OUTPUT OF THE PROGRAM

For loop
For loop in php


Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment