0% found this document useful (0 votes)
43 views5 pages

Practical 3

The document summarizes an experiment on demonstrating various looping structures in PHP, including while loops, do-while loops, for loops, and foreach loops. It provides the theory, learning objectives, required equipment, example programs and outputs for each loop type. The goal is for students to understand and be able to use different looping statements to solve problems.

Uploaded by

Shekhar Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views5 pages

Practical 3

The document summarizes an experiment on demonstrating various looping structures in PHP, including while loops, do-while loops, for loops, and foreach loops. It provides the theory, learning objectives, required equipment, example programs and outputs for each loop type. The goal is for students to understand and be able to use different looping statements to solve problems.

Uploaded by

Shekhar Jadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SamarthPolytechnicBelhe

DEPARTMENTOFCOMPUTERENGINEERING

Subject: WebBasedapplicationdevelopmentusingPHP. Subject code:22619

Semester: 6th Course: ComputerEngineering


Name of Subject Teacher :Prof.Kshirsagar.S.B LaboratoryNo:L001B
Name of Student: Phapale Siddhesh Ramdas Enrollmentno:2009920220
DateofPerformance: Date of Submission:

ExperimentNo: 3

TitleofExperiment: Write a program to demonstrate the use


oflooping structure using while
loop,do…whileloop,forloop, foreach
loop.

Theory:
1.0Title:
Write a program to demonstrate the use of looping structure using while loop, do….while
loop,forloop
foreach loop

2.0Loopingstatement

Itisconditional statementswhich areused toperformsome partofprogramagain andagain.

3.0NewConcepts:
Proposition1:whilestatement
Itisentrycontrolledloop. Conditionistested attheentryofbody ofloop.

Syntax:while(test-condition)

Body ofloop

}
Proposition 2:do….Whileloop

Itisentry controlled loop.Conditionistested attheend ofbodyofloop.

Syntax:do{

Body of loop

While(test-condition);

Proposition 3:forloop

It is entry controlled and more concise loop control

structureSyntax: for(initialization;test-

condition;increment-section)

Body ofloop

Proposition4:foreachloop

The foreach loop - Loops through a block of code for each element in an

array.Syntax: foreach($arrayas $value){

code tobeexecuted;

4.0 LearingOjectives:In

tellectualSkills:
1. Tounderstand the useofwhileloop
2. Tounderstand the useofdo…..whileloop
3. Tounderstand the useofforloop
4. Touseloopingstructure tosolvegivenproblem

MotorSkills:
1. Abilitytouseloopingstatements tosolvegivenproblem.
2. AbilitytousePHP webservers.
5.0 Apparatus:

Srno EquipmentNamewithbroadspecification Practical

1 Hardware:any computer system(preferablyi3or i5) All

2 OperatingSystem:Windows/Linux All

3 AnyDatabasetoolsuchasMYSQL,MariaDB 15,16

While Statement:-

Program:-

<?php
$x=1;
while($x<=5)
{
echo "the no is: $x <br>";
$x++;
}
?>
Output:-

Do…..whileloop

Program:-
<?php
$x=1;
do
{
echo "the no is: $x <br>";
$x++;
}
while($x<=5)
?>
Output:-

Forloop

Program:-

<?php
for($x=0;$x<=8;$x++)
{
echo"thenois:$x<br>";
}
?>

Output:-
Foreachloop

Program:-

<?php
$book=array("html","python","java","php");for
each($book as $value)

{
echo"$value<br>";
}
?>

Output:-

Process Product Total( Dated Sign


Gradeand Related Related 25M) OfTeacher
DatedSignatureof (15M) (10M)
Teacher

You might also like