SlideShare a Scribd company logo
PHP Language Operators & Control Structures
Switch-case() statement Switch (decision-variable) { case first condition is true: do this! case second condition is true: do this! . . . …  and so on … }
Appropriate case() block execution Depend on the value of decision variable Default block Decision variable not match any of the listed case() conditions
Example <?php // get form selection $day  =  $_GET [ 'day' ]; // check value and select appropriate item switch ( $day ) {     case  1 :          $special  =  'Chicken in oyster sauce' ;         break;     case  2 :          $special  =  'French onion soup' ;         break;     case  3 :          $special  =  'Pork chops with mashed potatoes and green salad' ;         break;     default:          $special  =  'Fish and chips' ;         break; } ?> <h2>Today's special is:</h2> <?php  echo  $special ?> </body> </html>
While() loop While (condition is true) { do this! }
Execution of php statements within curly braces As long as the specified condition is true Condition becomes false The loop will be broken and the following statement will be executed.
Examples <?php $number = 5; while   ($number  >= 2 ) { echo  $number.  &quot;<br/>&quot;  ; $number - = 1; } ?>
Examples Variable is initialized to 5 The while loop executes as long as the condition, ($number>=2) is true At the end of the loop block, the value of $number is decreased by 1.
Output of example
The while() loop executes a set of statements while a specified condition is true. But what happens if the condition is true on the first iteration of the loop itself? If you're in a situation where you need to execute a set of statements *at least* once, PHP offers you the do-while() loop.
Do-while() statement do {     do this! } while (condition is true)
While() vs do-while() Let's take a quick example to better understand the difference between while() and do-while():
Examples <?php $x  =  100 ; // while loop while ( $x  ==  700 ) {     echo  &quot;Running...&quot; ;     break; } ?>
In this case, no matter how many times you run this PHP script, you will get no output at all, since the value of $x is not equal to 700. But, if you ran this version of the script:
Example <?php $x  =  100 ; // do-while loop do {     echo  &quot;Running...&quot; ;     break; } while ( $x  ==  700 ); ?>
you would see  one  line of output, as the code within the do() block would run once.
<html> <head></head> <body> <?php // set variables from form input $upperLimit  =  $_POST [ 'limit' ]; $lowerLimit  =  1 ; // keep printing squares until lower limit = upper limit do {     echo ( $lowerLimit  *  $lowerLimit ). '&nbsp;' ;      $lowerLimit ++; } while ( $lowerLimit  <=  $upperLimit ); // print end marker echo  ' END' ; ?> </body> </html>
Thus, the construction of the do-while() loop is such that the statements within the loop are executed first, and the condition to be tested is checked afterwards. This implies that the statements within the curly braces would be executed at least once.
For() loops Both the while() and do-while() loops continue to iterate for as long as the specified conditional expression remains true. But what if you need to execute a certain set of statements a specific number of times - for example, printing a series of thirteen sequential numbers, or repeating a particular set of <td> cells five times? In such cases, clever programmers reach for the for() loop...
The for() loop typically looks like this:  for (initial value of counter; condition; new value of counter) {     do this! }
Examples <html> <head> <basefont face=&quot;Arial&quot;> </head> <body> <?php // define the number $number  =  13 ; // use a for loop to calculate tables for that number for ( $x  =  1 ;  $x  <=  10 ;  $x ++) {     echo  &quot;$number x $x = &quot; .( $number  *  $x ). &quot;<br />&quot; ; } ?> </body> </html>
define the number to be used for the multiplication table.  constructed a for() loop with $x as the counter variable, initialized it to 1.  specified that the loop should run no more than 10 times.  The auto-increment operator  automatically increments the counter by 1 every time the loop is executed. Within the loop, the counter is multiplied by the number,  to create the multiplication table, and echo() is used to display the result on the page.
Summary It is often desirable when writing code to perform different actions based on different decision. In addition to the if Statements, PHP includes a fourth type of conditional statement called the  switch  statement. The switch Statement is very similar or an alternative to the if...else if...else commands. The switch statement will test a condition. The outcome of that test will decide which case to execute. Switch is normally used when you are finding an exact (equal) result instead of a greater or less than result. When testing a range of values, the if statement should be used.
Summary In programming it is often necessary to repeat the same block of code a number of times. This can be accomplished using looping statements. PHP includes several types of looping statements.  The  while  statement loops through a block of code as long as a specified condition is evaluated as true. In other words, the while statement will execute a block of code if and as long as a condition is true.
Summary The  do...while  statement loops through a block of code as long as a specified condition is evaluated as true. In other words, the while statement will execute a block of code if and as long as a condition is true. The  do...while  loop is similar in nature to the  While  loop. The key difference is that the  do...while  loop body is guaranteed to run at least once. This is possible because the condition statement is evaluated at the end of the loop statement after the loop body is performed.
Summary The  for  statement loop is used when you know how many times you want to execute a statement or a list of statements. For this reason, the  for  loop is known as a definite loop.
<html> <head></head> <body> <?php // get form selection $day  =  $_GET [ 'day' ]; // check value and select appropriate item switch ( $day ) {     case  1 :          $special  =  'Chicken in oyster sauce' ;         break;     case  2 :          $special  =  'French onion soup' ;         break;     case  3 :          $special  =  'Pork chops with mashed potatoes and green salad' ;         break;     default:          $special  =  'Fish and chips' ;         break; } ?> <h2>Today's special is:</h2> <?php  echo  $special ?> </body> </html>

More Related Content

What's hot (20)

PHP variables
PHP variables
Siddique Ibrahim
 
Intermediate PHP
Intermediate PHP
Bradley Holt
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
julien pauli
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
Data Types In PHP
Data Types In PHP
Mark Niebergall
 
PHP7. Game Changer.
PHP7. Game Changer.
Haim Michael
 
Php Rss
Php Rss
mussawir20
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
TheCreativedev Blog
 
PHP Introduction and Training Material
PHP Introduction and Training Material
Manoj kumar
 
Lecture 2 php basics (1)
Lecture 2 php basics (1)
Core Lee
 
Zend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
Lorna Mitchell
 
PHP Basic
PHP Basic
Yoeung Vibol
 
My cool new Slideshow!
My cool new Slideshow!
omprakash_bagrao_prdxn
 
slidesharenew1
slidesharenew1
truptitasol
 
PHP Basics
PHP Basics
Bhaktaraz Bhatta
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
anshkhurana01
 
PHP
PHP
Rowena LI
 
Php Basic
Php Basic
Md. Sirajus Salayhin
 
The promise of asynchronous PHP
The promise of asynchronous PHP
Wim Godden
 
Class 3 - PHP Functions
Class 3 - PHP Functions
Ahmed Swilam
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
julien pauli
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
PHP7. Game Changer.
PHP7. Game Changer.
Haim Michael
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
TheCreativedev Blog
 
PHP Introduction and Training Material
PHP Introduction and Training Material
Manoj kumar
 
Lecture 2 php basics (1)
Lecture 2 php basics (1)
Core Lee
 
Zend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
Lorna Mitchell
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
anshkhurana01
 
The promise of asynchronous PHP
The promise of asynchronous PHP
Wim Godden
 
Class 3 - PHP Functions
Class 3 - PHP Functions
Ahmed Swilam
 

Similar to Php Operators N Controllers (20)

PHP CONDITIONAL STATEMENTS AND LOOPING.ppt
PHP CONDITIONAL STATEMENTS AND LOOPING.ppt
rehna9
 
What Is Php
What Is Php
AVC
 
Lesson 6 php if...else...elseif statements
Lesson 6 php if...else...elseif statements
MLG College of Learning, Inc
 
Php 2
Php 2
vivlinux
 
Web development
Web development
Seerat Bakhtawar
 
CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2
johnnygoodman
 
Php Loop
Php Loop
lotlot
 
course slides -- powerpoint
course slides -- powerpoint
webhostingguy
 
Statements and Conditions in PHP
Statements and Conditions in PHP
Maruf Abdullah (Rion)
 
03loop conditional statements
03loop conditional statements
Abdul Samad
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
Mohd Harris Ahmad Jaal
 
Php Chapter 1 Training
Php Chapter 1 Training
Chris Chubb
 
Basic PHP
Basic PHP
Todd Barber
 
Control Structures In Php 2
Control Structures In Php 2
Digital Insights - Digital Marketing Agency
 
php programming.pptx
php programming.pptx
rani marri
 
Php Training
Php Training
adfa
 
Php Basics Iterations, looping
Php Basics Iterations, looping
Muthuganesh S
 
Introduction in php part 2
Introduction in php part 2
Bozhidar Boshnakov
 
Php Crash Course
Php Crash Course
mussawir20
 
PHP MySQL
PHP MySQL
Md. Sirajus Salayhin
 
PHP CONDITIONAL STATEMENTS AND LOOPING.ppt
PHP CONDITIONAL STATEMENTS AND LOOPING.ppt
rehna9
 
What Is Php
What Is Php
AVC
 
CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2
johnnygoodman
 
Php Loop
Php Loop
lotlot
 
course slides -- powerpoint
course slides -- powerpoint
webhostingguy
 
03loop conditional statements
03loop conditional statements
Abdul Samad
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
Mohd Harris Ahmad Jaal
 
Php Chapter 1 Training
Php Chapter 1 Training
Chris Chubb
 
php programming.pptx
php programming.pptx
rani marri
 
Php Training
Php Training
adfa
 
Php Basics Iterations, looping
Php Basics Iterations, looping
Muthuganesh S
 
Php Crash Course
Php Crash Course
mussawir20
 
Ad

More from mussawir20 (20)

Database Design Process
Database Design Process
mussawir20
 
Php Simple Xml
Php Simple Xml
mussawir20
 
Php String And Regular Expressions
Php String And Regular Expressions
mussawir20
 
Php Sq Lite
Php Sq Lite
mussawir20
 
Php Sessoins N Cookies
Php Sessoins N Cookies
mussawir20
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
mussawir20
 
Php Oop
Php Oop
mussawir20
 
Php My Sql
Php My Sql
mussawir20
 
Php File Operations
Php File Operations
mussawir20
 
Php Error Handling
Php Error Handling
mussawir20
 
Php Basic Security
Php Basic Security
mussawir20
 
Php Using Arrays
Php Using Arrays
mussawir20
 
Javascript Oop
Javascript Oop
mussawir20
 
Html
Html
mussawir20
 
Javascript
Javascript
mussawir20
 
Object Range
Object Range
mussawir20
 
Prototype Utility Methods(1)
Prototype Utility Methods(1)
mussawir20
 
Date
Date
mussawir20
 
Prototype js
Prototype js
mussawir20
 
Template
Template
mussawir20
 
Database Design Process
Database Design Process
mussawir20
 
Php Simple Xml
Php Simple Xml
mussawir20
 
Php String And Regular Expressions
Php String And Regular Expressions
mussawir20
 
Php Sessoins N Cookies
Php Sessoins N Cookies
mussawir20
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
mussawir20
 
Php File Operations
Php File Operations
mussawir20
 
Php Error Handling
Php Error Handling
mussawir20
 
Php Basic Security
Php Basic Security
mussawir20
 
Php Using Arrays
Php Using Arrays
mussawir20
 
Javascript Oop
Javascript Oop
mussawir20
 
Prototype Utility Methods(1)
Prototype Utility Methods(1)
mussawir20
 
Ad

Recently uploaded (20)

Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 

Php Operators N Controllers

  • 1. PHP Language Operators & Control Structures
  • 2. Switch-case() statement Switch (decision-variable) { case first condition is true: do this! case second condition is true: do this! . . . … and so on … }
  • 3. Appropriate case() block execution Depend on the value of decision variable Default block Decision variable not match any of the listed case() conditions
  • 4. Example <?php // get form selection $day = $_GET [ 'day' ]; // check value and select appropriate item switch ( $day ) {     case 1 :          $special = 'Chicken in oyster sauce' ;         break;     case 2 :          $special = 'French onion soup' ;         break;     case 3 :          $special = 'Pork chops with mashed potatoes and green salad' ;         break;     default:          $special = 'Fish and chips' ;         break; } ?> <h2>Today's special is:</h2> <?php echo $special ?> </body> </html>
  • 5. While() loop While (condition is true) { do this! }
  • 6. Execution of php statements within curly braces As long as the specified condition is true Condition becomes false The loop will be broken and the following statement will be executed.
  • 7. Examples <?php $number = 5; while ($number >= 2 ) { echo $number. &quot;<br/>&quot; ; $number - = 1; } ?>
  • 8. Examples Variable is initialized to 5 The while loop executes as long as the condition, ($number>=2) is true At the end of the loop block, the value of $number is decreased by 1.
  • 10. The while() loop executes a set of statements while a specified condition is true. But what happens if the condition is true on the first iteration of the loop itself? If you're in a situation where you need to execute a set of statements *at least* once, PHP offers you the do-while() loop.
  • 11. Do-while() statement do {     do this! } while (condition is true)
  • 12. While() vs do-while() Let's take a quick example to better understand the difference between while() and do-while():
  • 13. Examples <?php $x = 100 ; // while loop while ( $x == 700 ) {     echo &quot;Running...&quot; ;     break; } ?>
  • 14. In this case, no matter how many times you run this PHP script, you will get no output at all, since the value of $x is not equal to 700. But, if you ran this version of the script:
  • 15. Example <?php $x = 100 ; // do-while loop do {     echo &quot;Running...&quot; ;     break; } while ( $x == 700 ); ?>
  • 16. you would see one line of output, as the code within the do() block would run once.
  • 17. <html> <head></head> <body> <?php // set variables from form input $upperLimit = $_POST [ 'limit' ]; $lowerLimit = 1 ; // keep printing squares until lower limit = upper limit do {     echo ( $lowerLimit * $lowerLimit ). '&nbsp;' ;      $lowerLimit ++; } while ( $lowerLimit <= $upperLimit ); // print end marker echo ' END' ; ?> </body> </html>
  • 18. Thus, the construction of the do-while() loop is such that the statements within the loop are executed first, and the condition to be tested is checked afterwards. This implies that the statements within the curly braces would be executed at least once.
  • 19. For() loops Both the while() and do-while() loops continue to iterate for as long as the specified conditional expression remains true. But what if you need to execute a certain set of statements a specific number of times - for example, printing a series of thirteen sequential numbers, or repeating a particular set of <td> cells five times? In such cases, clever programmers reach for the for() loop...
  • 20. The for() loop typically looks like this: for (initial value of counter; condition; new value of counter) {     do this! }
  • 21. Examples <html> <head> <basefont face=&quot;Arial&quot;> </head> <body> <?php // define the number $number = 13 ; // use a for loop to calculate tables for that number for ( $x = 1 ; $x <= 10 ; $x ++) {     echo &quot;$number x $x = &quot; .( $number * $x ). &quot;<br />&quot; ; } ?> </body> </html>
  • 22. define the number to be used for the multiplication table. constructed a for() loop with $x as the counter variable, initialized it to 1. specified that the loop should run no more than 10 times. The auto-increment operator automatically increments the counter by 1 every time the loop is executed. Within the loop, the counter is multiplied by the number, to create the multiplication table, and echo() is used to display the result on the page.
  • 23. Summary It is often desirable when writing code to perform different actions based on different decision. In addition to the if Statements, PHP includes a fourth type of conditional statement called the switch statement. The switch Statement is very similar or an alternative to the if...else if...else commands. The switch statement will test a condition. The outcome of that test will decide which case to execute. Switch is normally used when you are finding an exact (equal) result instead of a greater or less than result. When testing a range of values, the if statement should be used.
  • 24. Summary In programming it is often necessary to repeat the same block of code a number of times. This can be accomplished using looping statements. PHP includes several types of looping statements. The while statement loops through a block of code as long as a specified condition is evaluated as true. In other words, the while statement will execute a block of code if and as long as a condition is true.
  • 25. Summary The do...while statement loops through a block of code as long as a specified condition is evaluated as true. In other words, the while statement will execute a block of code if and as long as a condition is true. The do...while loop is similar in nature to the While loop. The key difference is that the do...while loop body is guaranteed to run at least once. This is possible because the condition statement is evaluated at the end of the loop statement after the loop body is performed.
  • 26. Summary The for statement loop is used when you know how many times you want to execute a statement or a list of statements. For this reason, the for loop is known as a definite loop.
  • 27. <html> <head></head> <body> <?php // get form selection $day = $_GET [ 'day' ]; // check value and select appropriate item switch ( $day ) {     case 1 :          $special = 'Chicken in oyster sauce' ;         break;     case 2 :          $special = 'French onion soup' ;         break;     case 3 :          $special = 'Pork chops with mashed potatoes and green salad' ;         break;     default:          $special = 'Fish and chips' ;         break; } ?> <h2>Today's special is:</h2> <?php echo $special ?> </body> </html>