SlideShare uma empresa Scribd logo
1 de 73
PHP (HYPERTEXT PREPROCESSOR)
Why PHP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Start Me Up   ,[object Object],[object Object]
PHP and HTML can be combined  ,[object Object]
Output
Comment in PHP code  ,[object Object],[object Object],[object Object]
A Case of Identity  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
example using PHP's variables  ,[object Object]
Output
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Variable-data types
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
example: ,[object Object],[object Object],[object Object]
Market Value  ,[object Object],[object Object],[object Object]
[object Object]
[object Object]
Output -75% -75 25 100 1000 Percent change in price Absolute change in price  Current price  Cost price  Quantity
[object Object],[object Object],mathematical operators
Example ,[object Object]
Stringing Things Along ,[object Object]
Example ,[object Object],[object Object],[object Object]
example ,[object Object],[object Object],[object Object]
Calling function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FORM ,[object Object],[object Object],[object Object],[object Object],[object Object],User (web browser) Web Server Enter data and the data are sent to Php script engine Passes data Process the data Give response or output
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],<html> <head> </head> <body> <form action=&quot;message.php&quot; method=&quot;post&quot;>  Enter your message: <input type=&quot;text&quot; name=&quot;msg&quot; size=&quot;30&quot;>  <input type=&quot;submit&quot; value=&quot;Send&quot;>  </form>  </body> </html>
[object Object],<html>  <head></head> <body>  <?php  // retrieve form data  $input  =  $_POST [ 'msg' ];  // use it  echo  &quot;You said: <i>$input</i>&quot; ;  ?>  </body>  </html>
operator ,[object Object]
 
Comparison operator <?php  /* define some variables */ $mean  =  9 ;  $median  =  10 ;  $mode  =  9 ;  // less-than operator  // returns true if left side is less than right  // returns true here  $result  = ( $mean  <  $median );  print  &quot;result is $result<br />&quot; ;
// greater-than operator  // returns true if left side is greater than right  // returns false here  $result  = ( $mean  >  $median );  print  &quot;result is $result<br />&quot; ;  // less-than-or-equal-to operator  // returns true if left side is less than or equal to right  // returns false here  $result  = ( $median  <=  $mode );  print  &quot;result is $result<br />&quot; ;
// greater-than-or-equal-to operator  // returns true if left side is greater than or equal to right  // returns true here  $result  = ( $median  >=  $mode );  print  &quot;result is $result<br />&quot; ;  // equality operator  // returns true if left side is equal to right  // returns true here  $result  = ( $mean  ==  $mode );  print  &quot;result is $result<br />&quot; ;
[object Object],// not-equal-to operator  // returns true if left side is not equal to right  // returns false here  $result  = ( $mean  !=  $mode );  print  &quot;result is $result<br />&quot; ;  // inequality operator  // returns true if left side is not equal to right  // returns false here  $result  = ( $mean  <>  $mode );  print  &quot;result is $result&quot; ;  ?>
=== operator <?php  /* define two variables */ $str  =  '10' ;  $int  =  10 ;  /* returns true, since both variables contain the same value */  $result  = ( $str  ==  $int );  print  &quot;result is $result<br />&quot; ;  /* returns false, since the variables are not of the same type even though they have the same value */  $result  = ( $str  ===  $int );  print  &quot;result is $result<br />&quot; ;   /* returns true, since the variables are the same type and value */  $anotherInt  =  10 ;  $result  = ( $anotherInt  ===  $int );  print  &quot;result is $result&quot; ;  ?>
Logical operator ,[object Object],<?php  /* define some variables */ $auth  =  1 ;  $status  =  1 ;  $role  =  4 ;  /* logical AND returns true if all conditions are true */  // returns true  $result  = (( $auth  ==  1 ) && ( $status  !=  0 ));  print  &quot;result is $result<br />&quot; ;
/* logical OR returns true if any condition is true */  // returns true  $result  = (( $status  ==  1 ) || ( $role  <=  2 ));  print  &quot;result is $result<br />&quot; ;  /* logical NOT returns true if the condition is false and vice-versa */  // returns false  $result  = !( $status  ==  1 );  print  &quot;result is $result<br />&quot; ;  /* logical XOR returns true if either of two conditions are true, or returns false if both conditions are true */  // returns false  $result  = (( $status  ==  1 ) xor ( $auth  ==  1 ));  print  &quot;result is $result<br />&quot; ;  ?>
Conditional statement ,[object Object],[object Object],[object Object],if ( expression ) { statement }
[object Object],<html>  <head></head> <body>  <form action=&quot;ageist.php&quot; method=&quot;post&quot;>  Enter your age: <input name=&quot;age&quot; size=&quot;2&quot;>  </form>  </body>  </html>
ageist.php <html>  <head></head> <body>  <?php  // retrieve form data  $age  =  $_POST [ 'age' ];  // check entered value and branch  if ( $age  >=  21 ) {       echo  'Come on in, we have alcohol and music awaiting you!' ;  }  if ( $age  <  21 ) {       echo  &quot;You're too young for this club, come back when you're a little older&quot; ;  }  ?>  </body>  </html>
[object Object],[object Object],if (condition) {      do this!      }  else {      do this!  }
[object Object],<html>  <head></head> <body>  <?php  // retrieve form data  $age  =  $_POST [ 'age' ];  // check entered value and branch  if ( $age  >=  21 ) {      echo  'Come on in, we have alcohol and music awaiting you!' ;      }  else {      echo  &quot;You're too young for this club, come back when you're a little older&quot; ;  }  ?>  </body>  </html>
Ternary operator ,[object Object],<?php  if ( $numTries  >  10 ) {        $msg  =  'Blocking your account...' ;      }  else {       $msg  =  'Welcome!' ;  }  ?>
[object Object],<?php  $msg  =  $numTries  >  10  ?  'Blocking your account...'  :  'Welcome!' ;  ?>
Nested if ,[object Object],<?php  if ( $day  ==  'Thursday' ) {      if ( $time  ==  '0800' ) {          if ( $country  ==  'UK' ) {               $meal  =  'bacon and eggs' ;          }      }  }  ?>   <?php  if ( $day  ==  'Thursday'  &&  $time  ==  '0800'  &&  $country  ==  'UK' ) {       $meal  =  'bacon and eggs' ;  }  ?>
<html>  <head></head> <body>  <h2>Today's Special</h2>  <p>  <form method=&quot;get&quot; action=&quot;cooking.php&quot;>  <select name=&quot;day&quot;>  <option value=&quot;1&quot;>Monday/Wednesday  <option value=&quot;2&quot;>Tuesday/Thursday  <option value=&quot;3&quot;>Friday/Sunday  <option value=&quot;4&quot;>Saturday  </select>  <input type=&quot;submit&quot; value=&quot;Send&quot;>  </form>  </body>  </html>
<html> <head></head> <body>  <?php  // get form selection  $day  =  $_GET [ 'day' ];  // check value and select appropriate item  if ( $day  ==  1 ) {       $special  =  'Chicken in oyster sauce' ;      }  elseif ( $day  ==  2 ) {       $special  =  'French onion soup' ;      }  elseif ( $day  ==  3 ) {       $special  =  'Pork chops with mashed potatoes and green salad' ;      }  else {       $special  =  'Fish and chips' ;  }  ?>  <h2>Today's special is:</h2>  <?php  echo  $special ;  ?>  </body> </html>
While() loop ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
Examples ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Examples ,[object Object],[object Object],[object Object]
Output of example
[object Object]
Do-while() statement ,[object Object]
While() vs do-while() ,[object Object]
Examples ,[object Object]
[object Object]
Example ,[object Object]
[object Object]
[object Object]
[object Object]
For() loops ,[object Object]
[object Object],[object Object]
Examples ,[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
Switch-case() statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object]
Summary ,[object Object],[object Object]
Summary ,[object Object]
Summary ,[object Object],[object Object]
Summary ,[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
Arjun Shanka
 
Php(report)
Php(report)Php(report)
Php(report)
Yhannah
 

Mais procurados (20)

PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
 
Web Development Course: PHP lecture 4
Web Development Course: PHP  lecture 4Web Development Course: PHP  lecture 4
Web Development Course: PHP lecture 4
 
Basic php 5
Basic php 5Basic php 5
Basic php 5
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php
PhpPhp
Php
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Chapter 02 php basic syntax
Chapter 02   php basic syntaxChapter 02   php basic syntax
Chapter 02 php basic syntax
 
PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
PHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginnersPHP complete reference with database concepts for beginners
PHP complete reference with database concepts for beginners
 
PHP Basic
PHP BasicPHP Basic
PHP Basic
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
 
07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards
 
Php(report)
Php(report)Php(report)
Php(report)
 
PHP
PHPPHP
PHP
 
Php by shivitomer
Php by shivitomerPhp by shivitomer
Php by shivitomer
 

Destaque

Droits Francais
Droits FrancaisDroits Francais
Droits Francais
essa1988
 
Sample Guide for Writing Website Development Proposal
Sample Guide for Writing Website Development ProposalSample Guide for Writing Website Development Proposal
Sample Guide for Writing Website Development Proposal
Patrick Ogbuitepu
 
Cd mobile-app-proposal
Cd mobile-app-proposalCd mobile-app-proposal
Cd mobile-app-proposal
Chase Daddy
 

Destaque (14)

Droits Francais
Droits FrancaisDroits Francais
Droits Francais
 
App proposal
App proposal App proposal
App proposal
 
App proposal nathan towel
App proposal   nathan towelApp proposal   nathan towel
App proposal nathan towel
 
Yahoo! App Mobile App Design Teardown
Yahoo! App Mobile App Design TeardownYahoo! App Mobile App Design Teardown
Yahoo! App Mobile App Design Teardown
 
Everlane iOS App Design Critique
Everlane iOS App Design CritiqueEverlane iOS App Design Critique
Everlane iOS App Design Critique
 
Khanz developers-golf-mobile-app-proposal
Khanz developers-golf-mobile-app-proposalKhanz developers-golf-mobile-app-proposal
Khanz developers-golf-mobile-app-proposal
 
Time it (App Proposal)
Time it (App Proposal)Time it (App Proposal)
Time it (App Proposal)
 
App Proposal: Baby Allergy Journal
App Proposal: Baby Allergy JournalApp Proposal: Baby Allergy Journal
App Proposal: Baby Allergy Journal
 
Mobile App Project Proposal: Betsy Scherertz
Mobile App Project Proposal: Betsy ScherertzMobile App Project Proposal: Betsy Scherertz
Mobile App Project Proposal: Betsy Scherertz
 
Sample Guide for Writing Website Development Proposal
Sample Guide for Writing Website Development ProposalSample Guide for Writing Website Development Proposal
Sample Guide for Writing Website Development Proposal
 
Cd mobile-app-proposal
Cd mobile-app-proposalCd mobile-app-proposal
Cd mobile-app-proposal
 
Website design and development company
Website design and development  companyWebsite design and development  company
Website design and development company
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 

Semelhante a Php Crash Course (20)

Php Calling Operators
Php Calling OperatorsPhp Calling Operators
Php Calling Operators
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control Etc
 
Php
PhpPhp
Php
 
Web development
Web developmentWeb development
Web development
 
Php 3 1
Php 3 1Php 3 1
Php 3 1
 
Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0
 
Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
John Rowley Notes
John Rowley NotesJohn Rowley Notes
John Rowley Notes
 
Php
PhpPhp
Php
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Php
PhpPhp
Php
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Php
PhpPhp
Php
 

Mais de mussawir20 (20)

Php Operators N Controllers
Php Operators N ControllersPhp Operators N Controllers
Php Operators N Controllers
 
Database Design Process
Database Design ProcessDatabase Design Process
Database Design Process
 
Php Simple Xml
Php Simple XmlPhp Simple Xml
Php Simple Xml
 
Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressions
 
Php Sq Lite
Php Sq LitePhp Sq Lite
Php Sq Lite
 
Php Sessoins N Cookies
Php Sessoins N CookiesPhp Sessoins N Cookies
Php Sessoins N Cookies
 
Php Rss
Php RssPhp Rss
Php Rss
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
 
Php Oop
Php OopPhp Oop
Php Oop
 
Php My Sql
Php My SqlPhp My Sql
Php My Sql
 
Php File Operations
Php File OperationsPhp File Operations
Php File Operations
 
Php Error Handling
Php Error HandlingPhp Error Handling
Php Error Handling
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
 
Php Using Arrays
Php Using ArraysPhp Using Arrays
Php Using Arrays
 
Javascript Oop
Javascript OopJavascript Oop
Javascript Oop
 
Html
HtmlHtml
Html
 
Javascript
JavascriptJavascript
Javascript
 
Object Range
Object RangeObject Range
Object Range
 
Prototype Utility Methods(1)
Prototype Utility Methods(1)Prototype Utility Methods(1)
Prototype Utility Methods(1)
 
Date
DateDate
Date
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Php Crash Course

  • 2.
  • 3.
  • 4.
  • 6.
  • 7.
  • 8.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Output -75% -75 25 100 1000 Percent change in price Absolute change in price Current price Cost price Quantity
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.  
  • 32. Comparison operator <?php /* define some variables */ $mean = 9 ; $median = 10 ; $mode = 9 ; // less-than operator // returns true if left side is less than right // returns true here $result = ( $mean < $median ); print &quot;result is $result<br />&quot; ;
  • 33. // greater-than operator // returns true if left side is greater than right // returns false here $result = ( $mean > $median ); print &quot;result is $result<br />&quot; ; // less-than-or-equal-to operator // returns true if left side is less than or equal to right // returns false here $result = ( $median <= $mode ); print &quot;result is $result<br />&quot; ;
  • 34. // greater-than-or-equal-to operator // returns true if left side is greater than or equal to right // returns true here $result = ( $median >= $mode ); print &quot;result is $result<br />&quot; ; // equality operator // returns true if left side is equal to right // returns true here $result = ( $mean == $mode ); print &quot;result is $result<br />&quot; ;
  • 35.
  • 36. === operator <?php /* define two variables */ $str = '10' ; $int = 10 ; /* returns true, since both variables contain the same value */ $result = ( $str == $int ); print &quot;result is $result<br />&quot; ; /* returns false, since the variables are not of the same type even though they have the same value */ $result = ( $str === $int ); print &quot;result is $result<br />&quot; ; /* returns true, since the variables are the same type and value */ $anotherInt = 10 ; $result = ( $anotherInt === $int ); print &quot;result is $result&quot; ; ?>
  • 37.
  • 38. /* logical OR returns true if any condition is true */ // returns true $result = (( $status == 1 ) || ( $role <= 2 )); print &quot;result is $result<br />&quot; ; /* logical NOT returns true if the condition is false and vice-versa */ // returns false $result = !( $status == 1 ); print &quot;result is $result<br />&quot; ; /* logical XOR returns true if either of two conditions are true, or returns false if both conditions are true */ // returns false $result = (( $status == 1 ) xor ( $auth == 1 )); print &quot;result is $result<br />&quot; ; ?>
  • 39.
  • 40.
  • 41. ageist.php <html> <head></head> <body> <?php // retrieve form data $age = $_POST [ 'age' ]; // check entered value and branch if ( $age >= 21 ) {      echo 'Come on in, we have alcohol and music awaiting you!' ; } if ( $age < 21 ) {      echo &quot;You're too young for this club, come back when you're a little older&quot; ; } ?> </body> </html>
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. <html> <head></head> <body> <h2>Today's Special</h2> <p> <form method=&quot;get&quot; action=&quot;cooking.php&quot;> <select name=&quot;day&quot;> <option value=&quot;1&quot;>Monday/Wednesday <option value=&quot;2&quot;>Tuesday/Thursday <option value=&quot;3&quot;>Friday/Sunday <option value=&quot;4&quot;>Saturday </select> <input type=&quot;submit&quot; value=&quot;Send&quot;> </form> </body> </html>
  • 48. <html> <head></head> <body> <?php // get form selection $day = $_GET [ 'day' ]; // check value and select appropriate item if ( $day == 1 ) {      $special = 'Chicken in oyster sauce' ;     } elseif ( $day == 2 ) {      $special = 'French onion soup' ;     } elseif ( $day == 3 ) {      $special = 'Pork chops with mashed potatoes and green salad' ;     } else {      $special = 'Fish and chips' ; } ?> <h2>Today's special is:</h2> <?php echo $special ; ?> </body> </html>
  • 49.
  • 50.
  • 51.
  • 52.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.