SlideShare a Scribd company logo
1 of 23
ALL ABOUT
YOU NEED TO KNOW.
CONTENTS
• > INTRODUCTION
• > ORIGINS AND USES OF PHP
• > OVERVIEW OF PHP
• > WHAT CAN PHP DO
• > HOW PHP WORK
• > WHAT WILL YOU NEED
• > PHP INSTALLATION
• > PHP SYNTAX
• > BASIC CODE SYNTAX
• > VARIABLES
• > STRING VARIABLE IN PHP
• > PHP VARIABLES
• > VARIABLES NAME
• > OUTPUTS
• > CONTROL STATEMENT
• > PHP EXAMPLES
INTRODUCTION
• * PHP stands for PHP: Hypertext Preprocessor
• * PHP is a server-side scripting language, like ASP
• * PHP scripts are executed on the server
• * PHP supports many databases (MySQL, Informix,
Oracle, Sybase, Solid etc.
• * PHP is an open source software (OSS).
ORIGINS AND USES OF PHP
• > Origins
• - Rasmus Lerdorf – 1994.
• - Developed to allow him to track visitors to his Web
site.
> PHP is an open-source product.
• > PHP is an acronym for Personal Home Page, or PHP
: Hypertext Preprocessing, and database access.
OVERVIEW OF PHP
• •> PHP is a server-side scripting language , like ASP
• •> PHP scripts are executed on the server
• •> PHP supports many databases (MySQL, Informix, Oracle, Sybase, etc.
• •> PHP is an open-source software (OSS)
• •> What is a PHP File?
• - PHP files may contain text, HTML tags and scripts
• - PHP files are returned to the browser as plain HTML
• - PHP files have a file extension of “.php” ,”php3” , or “.Phtml”
WHAT CAN PHP DO?
• > Query a database
• > Allow users to upload files
• > Create/read files on the server (for example, the files
that you users upload)
• > Have a “members area” (i.e via a login page)
• > Have a shopping cart
HOW PHP WORK?
• PHP is a server-side language that means the code
written in php resides on a host computer called a
server. The server sends Web pages to the requesting
visitors (you , the client ,with your web browser)
WHAT WILL YOU NEED?
• •> A web server application (Apache, Xitami , or
IIS)
• •> PHP
• •> My SQL
• •> Web Browser
• •> Text editor, PHP-capable WYSIWYG application
(Adobe Dreamweaver / Kompozer / Amaya) or IDE
(integrated development environment)
• •> FTP application if using a remote server
PHP INSTALLATION
• You need to install web server before you install PHP.
• There are many different web servers available to choose
from, so you need to choose which one you prefer.
• Two of the more popular web services are:
• > Apache
• > internet Information Services (IIS)
PHP SYNTAX
• The PHP syntax on C , Java, and peral , creating a PHP
file is similar to creating an HTML file. In fact, most
PHP files are a mixture of PHP code and HTML.
To create a PHP file , simply do the following:
1. Create a new file in your favorite editor
2. Type some PHP code
3. Save the file with a .php extension
BASIC CODE SYNTAX
<?
PHP Code In
Here
?>
<?php
PHP Code In
Here
php?>
<script
language=“php>
PHP code In
Here
</script>
<html>
<head>
<title>PHP Syntax Example</title>
</head>
<body>
<?php
Echo “PHP is easy!”;
?>
</body>
</html>
VARIABLES
> Variables are used to storing values, like text strings,
number of arrays.
• > When a variable is declared , it can be used over
and over again in your script.
• >All variables in PHP start with a $ sign symbol.
• > The correct wat of declaring a variable in PHP:
$var _ name = value;
STRING VARIABLES IN PHP
• String variable are used for values that contains
characters.
• <?php
$txt=“Hello World ;
echo $txt;
?>
PHP VARIABLES
• A variable can have a short name (like x and y) or a more descriptive name (ages, carn
• total_volume).
• Rules for PHP variables:
• > A variable starts with the $ sign, followed by the name of the variable.
• > A variable name must start with a letter or the underscore character.
• > A variable name cannot start with a number.
• > A variable name can only contain alpha-numeric characters and underscores
(A-z, 0-9, and_).
> Variable names are case-sensitive ($age and $ AGE are two different variables.
PHP VARIABLES
• <?php
• $variable1= 2;
• $variable 2 = 9;
• $variable3 = $variable1 + $variable2;
• echo $variable3;
• ?>
VARIABLES NAME
• Variable names can only contain alpha-numeric
characters and underscore (i.e a-z, A-Z, 0-9, or _)
• Variables names must not contain spaces. For multi-
word variable names , either separate the words with
an underscore ( _ ) or use capitalization.
OUTPUTS
• Output from a PHP scripts is HTML that is sent to the browser.
• HTML is sent to the browser through standard output .
• There are three ways to produce output: echo, print, and printf.
• - echo and print take a string, but will coerce other value to strings
echo
• “Test” , “None” ; #More than one parameter acceptable echo (“first
<br />”
• $sum) # More than one, so ILLEGAL! Print “welcome to my site!”; #
Only
• one printf –same like C
• PHP code is placed in the body of an HTML document
OUTPUTS
• <html>
• <head><title> Trivial php example </title>
• </head>
• <body>
• <?php
• print “welcome to my site1”;
• ?>
• </body>
• </html>
CONTROL STATEMENT
• > Control Expressions
• - Relational operators – same as Javascript (including === and ! ==)
• - Boolean operators – same as perl (two sets, && and and, etc.)
• > Selection statements
• - if, if-else, elseif
• - switch – as in C
• The switch expression type must be integer, double, or string
• - While- just like C
• - do-while – just like C
• - for – just like C
• - foreach – discussed later
• - break - in any for, foreach, while, do-while, or switch
• - continue – in any loop
CONTROL STATEMENTS
• <?php
• $a = 7;
• $b = 7;
• if ($a == $b) {
• $a = 3 * $a;
• ?>
• <br />At this point, $a and $b are equal <br />
• So, we change $a to three times $A
• <?php
• }
• ?>
PHP EXAMPLES
• The following example prints the text “Hello World”
five times:
• <html>
• <body><?php
• for ($=1; $<=5; $i++)
• {
• echo “Hello world!<br />”;
• }
• ?></body>
• </html>
PHP EXAMPLES
• The following example will output “Have a nice weekened! “ if the current
day is Friday , otherwise it will output “Have a nice day!” :
• <html>
• <body><?php
• $d=date(“D”);
• If ($d ==“Fri”)
• Echo “Have a nice weekened”;
• Else
• Echo “Have a nice day!”;
• ?></body>
• </html
INTRODUCTION to php.pptx

More Related Content

Similar to INTRODUCTION to php.pptx

Similar to INTRODUCTION to php.pptx (20)

Prersentation
PrersentationPrersentation
Prersentation
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
1. introduction to php and variable
1. introduction to php and variable1. introduction to php and variable
1. introduction to php and variable
 
PHP MySQL Workshop - facehook
PHP MySQL Workshop - facehookPHP MySQL Workshop - facehook
PHP MySQL Workshop - facehook
 
php basic part one
php basic part onephp basic part one
php basic part one
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
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...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...
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Introduction to PHP.pptx
Introduction to PHP.pptxIntroduction to PHP.pptx
Introduction to PHP.pptx
 
Intro about PHP,PHP Training in jaipur
Intro about PHP,PHP Training in jaipurIntro about PHP,PHP Training in jaipur
Intro about PHP,PHP Training in jaipur
 
Introduction About PHP
 Introduction About PHP Introduction About PHP
Introduction About PHP
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
 
Upstate CSCI 450 PHP
Upstate CSCI 450 PHPUpstate CSCI 450 PHP
Upstate CSCI 450 PHP
 
Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
PHP
PHPPHP
PHP
 
Php
PhpPhp
Php
 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
 
PHP
PHPPHP
PHP
 
php (Hypertext Preprocessor)
php (Hypertext Preprocessor)php (Hypertext Preprocessor)
php (Hypertext Preprocessor)
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

INTRODUCTION to php.pptx

  • 2. CONTENTS • > INTRODUCTION • > ORIGINS AND USES OF PHP • > OVERVIEW OF PHP • > WHAT CAN PHP DO • > HOW PHP WORK • > WHAT WILL YOU NEED • > PHP INSTALLATION • > PHP SYNTAX • > BASIC CODE SYNTAX • > VARIABLES • > STRING VARIABLE IN PHP • > PHP VARIABLES • > VARIABLES NAME • > OUTPUTS • > CONTROL STATEMENT • > PHP EXAMPLES
  • 3. INTRODUCTION • * PHP stands for PHP: Hypertext Preprocessor • * PHP is a server-side scripting language, like ASP • * PHP scripts are executed on the server • * PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid etc. • * PHP is an open source software (OSS).
  • 4. ORIGINS AND USES OF PHP • > Origins • - Rasmus Lerdorf – 1994. • - Developed to allow him to track visitors to his Web site. > PHP is an open-source product. • > PHP is an acronym for Personal Home Page, or PHP : Hypertext Preprocessing, and database access.
  • 5. OVERVIEW OF PHP • •> PHP is a server-side scripting language , like ASP • •> PHP scripts are executed on the server • •> PHP supports many databases (MySQL, Informix, Oracle, Sybase, etc. • •> PHP is an open-source software (OSS) • •> What is a PHP File? • - PHP files may contain text, HTML tags and scripts • - PHP files are returned to the browser as plain HTML • - PHP files have a file extension of “.php” ,”php3” , or “.Phtml”
  • 6. WHAT CAN PHP DO? • > Query a database • > Allow users to upload files • > Create/read files on the server (for example, the files that you users upload) • > Have a “members area” (i.e via a login page) • > Have a shopping cart
  • 7. HOW PHP WORK? • PHP is a server-side language that means the code written in php resides on a host computer called a server. The server sends Web pages to the requesting visitors (you , the client ,with your web browser)
  • 8. WHAT WILL YOU NEED? • •> A web server application (Apache, Xitami , or IIS) • •> PHP • •> My SQL • •> Web Browser • •> Text editor, PHP-capable WYSIWYG application (Adobe Dreamweaver / Kompozer / Amaya) or IDE (integrated development environment) • •> FTP application if using a remote server
  • 9. PHP INSTALLATION • You need to install web server before you install PHP. • There are many different web servers available to choose from, so you need to choose which one you prefer. • Two of the more popular web services are: • > Apache • > internet Information Services (IIS)
  • 10. PHP SYNTAX • The PHP syntax on C , Java, and peral , creating a PHP file is similar to creating an HTML file. In fact, most PHP files are a mixture of PHP code and HTML. To create a PHP file , simply do the following: 1. Create a new file in your favorite editor 2. Type some PHP code 3. Save the file with a .php extension
  • 11. BASIC CODE SYNTAX <? PHP Code In Here ?> <?php PHP Code In Here php?> <script language=“php> PHP code In Here </script> <html> <head> <title>PHP Syntax Example</title> </head> <body> <?php Echo “PHP is easy!”; ?> </body> </html>
  • 12. VARIABLES > Variables are used to storing values, like text strings, number of arrays. • > When a variable is declared , it can be used over and over again in your script. • >All variables in PHP start with a $ sign symbol. • > The correct wat of declaring a variable in PHP: $var _ name = value;
  • 13. STRING VARIABLES IN PHP • String variable are used for values that contains characters. • <?php $txt=“Hello World ; echo $txt; ?>
  • 14. PHP VARIABLES • A variable can have a short name (like x and y) or a more descriptive name (ages, carn • total_volume). • Rules for PHP variables: • > A variable starts with the $ sign, followed by the name of the variable. • > A variable name must start with a letter or the underscore character. • > A variable name cannot start with a number. • > A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and_). > Variable names are case-sensitive ($age and $ AGE are two different variables.
  • 15. PHP VARIABLES • <?php • $variable1= 2; • $variable 2 = 9; • $variable3 = $variable1 + $variable2; • echo $variable3; • ?>
  • 16. VARIABLES NAME • Variable names can only contain alpha-numeric characters and underscore (i.e a-z, A-Z, 0-9, or _) • Variables names must not contain spaces. For multi- word variable names , either separate the words with an underscore ( _ ) or use capitalization.
  • 17. OUTPUTS • Output from a PHP scripts is HTML that is sent to the browser. • HTML is sent to the browser through standard output . • There are three ways to produce output: echo, print, and printf. • - echo and print take a string, but will coerce other value to strings echo • “Test” , “None” ; #More than one parameter acceptable echo (“first <br />” • $sum) # More than one, so ILLEGAL! Print “welcome to my site!”; # Only • one printf –same like C • PHP code is placed in the body of an HTML document
  • 18. OUTPUTS • <html> • <head><title> Trivial php example </title> • </head> • <body> • <?php • print “welcome to my site1”; • ?> • </body> • </html>
  • 19. CONTROL STATEMENT • > Control Expressions • - Relational operators – same as Javascript (including === and ! ==) • - Boolean operators – same as perl (two sets, && and and, etc.) • > Selection statements • - if, if-else, elseif • - switch – as in C • The switch expression type must be integer, double, or string • - While- just like C • - do-while – just like C • - for – just like C • - foreach – discussed later • - break - in any for, foreach, while, do-while, or switch • - continue – in any loop
  • 20. CONTROL STATEMENTS • <?php • $a = 7; • $b = 7; • if ($a == $b) { • $a = 3 * $a; • ?> • <br />At this point, $a and $b are equal <br /> • So, we change $a to three times $A • <?php • } • ?>
  • 21. PHP EXAMPLES • The following example prints the text “Hello World” five times: • <html> • <body><?php • for ($=1; $<=5; $i++) • { • echo “Hello world!<br />”; • } • ?></body> • </html>
  • 22. PHP EXAMPLES • The following example will output “Have a nice weekened! “ if the current day is Friday , otherwise it will output “Have a nice day!” : • <html> • <body><?php • $d=date(“D”); • If ($d ==“Fri”) • Echo “Have a nice weekened”; • Else • Echo “Have a nice day!”; • ?></body> • </html