SlideShare a Scribd company logo
WELCOME TO
OUR PRESENTATION
MEMBERS INTRO
 MD. IMRAN HOSSAIN {{ 183-25-691 }}
 MARUF ABDULLAH {{ 183-25-706 }}
 FAHIM FOYSAL KHAN {{ 183-25-692 }}
 SUMON HAZRA {{ 181-25-644 }}
 PRITOMA DEBNATH {{ 181-25-653 }}
WE ARE COVERING FOLLOWING TOPICS
 If...Else...Elseif Statements
 Switch Statement
 For Loop
 While Loop
 Do…While Loop
IF …. ELSE …. ELSEIF
 if statement executes some code if one condition
is true.
 if...else statement executes some code if a
condition is true and another code if that condition
is false.
 if...elseif....else statement executes different
codes for more than two conditions.
EXAMPLE OF IF...ELSEIF...ELSE
<?php
$date = date("D");
if($date == "Friday"){
echo "Have a nice weekend!";
} elseif($date == "Sunday"){
echo "Have a nice Sunday!";
} else{
echo "Have a nice day!";
}
?>
OUTPUT (IF…ELSE…ELSEIF)
SWITCH STATEMENT
 Switch Statement tests a variable against a
series of values.
 We can assume Switch Statement is an
alternative to the if…elseif…else statement.
EXAMPLE OF SWITCH STATEMENT
<?php
$date = date("D");
Switch ($date){
case "Friday ":
echo "Have a nice weekend";
break;
case "Sunday":
echo "Have a nice Sunday!";
break;
default:
echo "Have a Nice Day!";
break;
}
?>
OUTPUT (SWITCH STATEMENT)
FOR LOOP
 For loop executes a block of code a specified
number of times.
 Basic Syntax of For Loop:
for ( init counter; test counter; increment
counter) {
code to be executed;
}
EXAMPLE OF FOR LOOP
<?php
for ($x = 0; $x <= 10; $x++) {
echo "The number is: " . $x . "<br>";
}
?>
OUTPUT (FOR LOOP)
WHILE LOOP
 While loop executes a block of code as long
as the specified condition is true.
 Basic Syntax of While Loop:
while (condition is true) {
// code to be executed;
}
EXAMPLE OF WHILE LOOP
<?php
$x = 1;
while($x <= 5) {
echo "The number is: $x <br>";
$x++;
}
?>
OUTPUT (WHILE LOOP)
DO…WHILE LOOP
 Do...While loop will always execute the block
of code once, it will then check the condition,
and repeat the loop while the specified
condition is true.
 Basic syntax of Do…While Loop:
do {
// code to be executed;
} while (condition is true);
EXAMPLE OF DO…WHILE LOOP
<?php
$x = 6;
do {
echo "The number is: $x <br>";
$x++;
} while ($x <= 5);
?>
OUTPUT (DO …. WHILE LOOP)
THANK YOU

More Related Content

What's hot

JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
ShahDhruv21
 
Looping statement
Looping statementLooping statement
Looping statementilakkiya
 
PHP
PHPPHP
Php.ppt
Php.pptPhp.ppt
Php.ppt
Nidhi mishra
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
Computer Hardware & Trouble shooting
 
PHP
PHPPHP
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
Tiji Thomas
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
Vineet Kumar Saini
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
C# Loops
C# LoopsC# Loops
C# Loops
Hock Leng PUAH
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
JavaScript - Chapter 10 - Strings and Arrays
 JavaScript - Chapter 10 - Strings and Arrays JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 10 - Strings and Arrays
WebStackAcademy
 

What's hot (20)

JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Looping statement
Looping statementLooping statement
Looping statement
 
PHP
PHPPHP
PHP
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
php
phpphp
php
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
PHP
PHPPHP
PHP
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 
PHP slides
PHP slidesPHP slides
PHP slides
 
C# Loops
C# LoopsC# Loops
C# Loops
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
JavaScript - Chapter 10 - Strings and Arrays
 JavaScript - Chapter 10 - Strings and Arrays JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 10 - Strings and Arrays
 

Similar to Statements and Conditions in PHP

Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
Mohd Harris Ahmad Jaal
 
Php Operators N Controllers
Php Operators N ControllersPhp Operators N Controllers
Php Operators N Controllersmussawir20
 
PHP-Part2
PHP-Part2PHP-Part2
PHP-Part2
Ahmed Saihood
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statements
Abdul Samad
 
Lesson 6 php if...else...elseif statements
Lesson 6   php if...else...elseif statementsLesson 6   php if...else...elseif statements
Lesson 6 php if...else...elseif statements
MLG College of Learning, Inc
 
Chapter 03 conditional statements
Chapter 03   conditional statementsChapter 03   conditional statements
Chapter 03 conditional statements
Dhani Ahmad
 
PHP - Web Development
PHP - Web DevelopmentPHP - Web Development
PHP - Web Development
Niladri Karmakar
 
c++ Lecture 3
c++ Lecture 3c++ Lecture 3
c++ Lecture 3sajidpk92
 
c++ Lecture 4
c++ Lecture 4c++ Lecture 4
c++ Lecture 4sajidpk92
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Loops (Refined).pptx
Loops (Refined).pptxLoops (Refined).pptx
Loops (Refined).pptx
chimkwuogworordu
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
prabhatjon
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
Mandakini Kumari
 
07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards
Denis Ristic
 
Free PHP Book Online | PHP Development in India
Free PHP Book Online | PHP Development in IndiaFree PHP Book Online | PHP Development in India
Free PHP Book Online | PHP Development in India
Deepak Rajput
 

Similar to Statements and Conditions in PHP (20)

Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
 
Php Operators N Controllers
Php Operators N ControllersPhp Operators N Controllers
Php Operators N Controllers
 
PHP-Part2
PHP-Part2PHP-Part2
PHP-Part2
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statements
 
Lesson 6 php if...else...elseif statements
Lesson 6   php if...else...elseif statementsLesson 6   php if...else...elseif statements
Lesson 6 php if...else...elseif statements
 
Chapter 03 conditional statements
Chapter 03   conditional statementsChapter 03   conditional statements
Chapter 03 conditional statements
 
PHP - Web Development
PHP - Web DevelopmentPHP - Web Development
PHP - Web Development
 
Control structures
Control structuresControl structures
Control structures
 
Loops
LoopsLoops
Loops
 
csc ppt 15.pptx
csc ppt 15.pptxcsc ppt 15.pptx
csc ppt 15.pptx
 
PHP
PHPPHP
PHP
 
c++ Lecture 3
c++ Lecture 3c++ Lecture 3
c++ Lecture 3
 
c++ Lecture 4
c++ Lecture 4c++ Lecture 4
c++ Lecture 4
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Loops (Refined).pptx
Loops (Refined).pptxLoops (Refined).pptx
Loops (Refined).pptx
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards
 
Free PHP Book Online | PHP Development in India
Free PHP Book Online | PHP Development in IndiaFree PHP Book Online | PHP Development in India
Free PHP Book Online | PHP Development in India
 

More from Maruf Abdullah (Rion)

Dynamic Systems Development Method (DSDM) - Agile
Dynamic Systems Development Method (DSDM) - AgileDynamic Systems Development Method (DSDM) - Agile
Dynamic Systems Development Method (DSDM) - Agile
Maruf Abdullah (Rion)
 
Common Excel Shortcut Keys
Common Excel Shortcut KeysCommon Excel Shortcut Keys
Common Excel Shortcut Keys
Maruf Abdullah (Rion)
 
Simulation Queuing System Example | Simulation & Modeling
Simulation Queuing System Example | Simulation & ModelingSimulation Queuing System Example | Simulation & Modeling
Simulation Queuing System Example | Simulation & Modeling
Maruf Abdullah (Rion)
 
What is Big Data?
What is Big Data?What is Big Data?
What is Big Data?
Maruf Abdullah (Rion)
 
How to be a Successful Freelancer (Bangla)
How to be a Successful Freelancer (Bangla)How to be a Successful Freelancer (Bangla)
How to be a Successful Freelancer (Bangla)
Maruf Abdullah (Rion)
 
Relationship Between Big Data & AI
Relationship Between Big Data & AIRelationship Between Big Data & AI
Relationship Between Big Data & AI
Maruf Abdullah (Rion)
 
Health Prediction System - an Artificial Intelligence Project 2015
Health Prediction System - an Artificial Intelligence Project 2015Health Prediction System - an Artificial Intelligence Project 2015
Health Prediction System - an Artificial Intelligence Project 2015
Maruf Abdullah (Rion)
 
E-Voting System Development (Software Engineering Presentation)
E-Voting System Development (Software Engineering Presentation)E-Voting System Development (Software Engineering Presentation)
E-Voting System Development (Software Engineering Presentation)
Maruf Abdullah (Rion)
 
Presentation on Big Data
Presentation on Big DataPresentation on Big Data
Presentation on Big Data
Maruf Abdullah (Rion)
 
Evolution of Mobile Network Technology
Evolution of Mobile Network TechnologyEvolution of Mobile Network Technology
Evolution of Mobile Network Technology
Maruf Abdullah (Rion)
 
Restaurant Management System
Restaurant Management SystemRestaurant Management System
Restaurant Management System
Maruf Abdullah (Rion)
 

More from Maruf Abdullah (Rion) (11)

Dynamic Systems Development Method (DSDM) - Agile
Dynamic Systems Development Method (DSDM) - AgileDynamic Systems Development Method (DSDM) - Agile
Dynamic Systems Development Method (DSDM) - Agile
 
Common Excel Shortcut Keys
Common Excel Shortcut KeysCommon Excel Shortcut Keys
Common Excel Shortcut Keys
 
Simulation Queuing System Example | Simulation & Modeling
Simulation Queuing System Example | Simulation & ModelingSimulation Queuing System Example | Simulation & Modeling
Simulation Queuing System Example | Simulation & Modeling
 
What is Big Data?
What is Big Data?What is Big Data?
What is Big Data?
 
How to be a Successful Freelancer (Bangla)
How to be a Successful Freelancer (Bangla)How to be a Successful Freelancer (Bangla)
How to be a Successful Freelancer (Bangla)
 
Relationship Between Big Data & AI
Relationship Between Big Data & AIRelationship Between Big Data & AI
Relationship Between Big Data & AI
 
Health Prediction System - an Artificial Intelligence Project 2015
Health Prediction System - an Artificial Intelligence Project 2015Health Prediction System - an Artificial Intelligence Project 2015
Health Prediction System - an Artificial Intelligence Project 2015
 
E-Voting System Development (Software Engineering Presentation)
E-Voting System Development (Software Engineering Presentation)E-Voting System Development (Software Engineering Presentation)
E-Voting System Development (Software Engineering Presentation)
 
Presentation on Big Data
Presentation on Big DataPresentation on Big Data
Presentation on Big Data
 
Evolution of Mobile Network Technology
Evolution of Mobile Network TechnologyEvolution of Mobile Network Technology
Evolution of Mobile Network Technology
 
Restaurant Management System
Restaurant Management SystemRestaurant Management System
Restaurant Management System
 

Recently uploaded

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 

Recently uploaded (20)

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 

Statements and Conditions in PHP

  • 2. MEMBERS INTRO  MD. IMRAN HOSSAIN {{ 183-25-691 }}  MARUF ABDULLAH {{ 183-25-706 }}  FAHIM FOYSAL KHAN {{ 183-25-692 }}  SUMON HAZRA {{ 181-25-644 }}  PRITOMA DEBNATH {{ 181-25-653 }}
  • 3. WE ARE COVERING FOLLOWING TOPICS  If...Else...Elseif Statements  Switch Statement  For Loop  While Loop  Do…While Loop
  • 4. IF …. ELSE …. ELSEIF  if statement executes some code if one condition is true.  if...else statement executes some code if a condition is true and another code if that condition is false.  if...elseif....else statement executes different codes for more than two conditions.
  • 5. EXAMPLE OF IF...ELSEIF...ELSE <?php $date = date("D"); if($date == "Friday"){ echo "Have a nice weekend!"; } elseif($date == "Sunday"){ echo "Have a nice Sunday!"; } else{ echo "Have a nice day!"; } ?>
  • 7. SWITCH STATEMENT  Switch Statement tests a variable against a series of values.  We can assume Switch Statement is an alternative to the if…elseif…else statement.
  • 8. EXAMPLE OF SWITCH STATEMENT <?php $date = date("D"); Switch ($date){ case "Friday ": echo "Have a nice weekend"; break; case "Sunday": echo "Have a nice Sunday!"; break; default: echo "Have a Nice Day!"; break; } ?>
  • 10. FOR LOOP  For loop executes a block of code a specified number of times.  Basic Syntax of For Loop: for ( init counter; test counter; increment counter) { code to be executed; }
  • 11. EXAMPLE OF FOR LOOP <?php for ($x = 0; $x <= 10; $x++) { echo "The number is: " . $x . "<br>"; } ?>
  • 13. WHILE LOOP  While loop executes a block of code as long as the specified condition is true.  Basic Syntax of While Loop: while (condition is true) { // code to be executed; }
  • 14. EXAMPLE OF WHILE LOOP <?php $x = 1; while($x <= 5) { echo "The number is: $x <br>"; $x++; } ?>
  • 16. DO…WHILE LOOP  Do...While loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.  Basic syntax of Do…While Loop: do { // code to be executed; } while (condition is true);
  • 17. EXAMPLE OF DO…WHILE LOOP <?php $x = 6; do { echo "The number is: $x <br>"; $x++; } while ($x <= 5); ?>
  • 18. OUTPUT (DO …. WHILE LOOP)