SlideShare uma empresa Scribd logo
1 de 12
What is PHP?
PHP is an HTML-embedded scripting language. The
 goal of the language is to allow web developers to
 write dynamically generated pages quickly.
PHP will allow you to:
 Reduce the time to create large websites it’s an Open
  Source Software.
 Create a customized user experience for visitors
  based on information that you have gathered from
  them
What You Should Know
Before starting this tutorial it is important that you have
 a basic understanding and experience in the
 following:
HTML - Know the syntax and especially HTML forms.
Basic programming knowledge - This isn't required,
 but if you have any traditional programming
 experience it will make learning PHP a great deal
 easier.
PHP Syntax
 Syntax: The rules that must be followed to write
  properly structured code
 You can put your PHP code inside the body of HTML
 The PHP code is enclosed with
  <?php
    //your code here.
  ?>
example
<html>
<head>
 <title>Hello in PHP</title>
</head>
<body>
  <h1>Hello in PHP</h1>
      <? echo "Hello, world!“; ?>
</body>
</html>
Example 2: HTML & PHP
<html>
 <head>
 <title>My First PHP Page</title>
 </head>
 <body>
 <?php
      echo "Hello World!";
 ?>
 </body>
 </html>
PHP - Variables
 A variable is a means of storing a value, such as text string "Hello
   World!" or the integer value 4. A variable can then be reused
   throughout your code, instead of having to type out the actual value,
   over and over again.
   In PHP you define a variable with the following form:
Example:
   $variable_name = Value;
Description:
If you forget that dollar sign at the beginning and the semi-colon at the
   end, it will not work. This is a common mistake for new PHP
   programmers!
Outputting a String.
 PHP
<?php
        echo "Hello!";
        echo "<h5>I love using PHP!</h5>";
?>
 Output
  Hello!
  I love using PHP!
Using Comment in PHP
 Comments in PHP are similar to comments that are used
  in HTML. A comment is started with a special character
  sequence and all text that appears between the start of the
  comment and the end will be ignored by the browser.
 Single Line Comment
  // this a single line statement
 Multiple Line Comment
        /* this is a multiple
           line comment.
        */
Creating HTML form
<html><body>
  <h4>ABC Art Supply Order Form</h4>
  <form>
  <select>
        <option>Paint</option>
        <option>Brushes</option>
        <option>Erasers</option>
  </select>
  Quantity: <input type="text" />
  <input type="submit" />
  </form>
  </body></html>
Output
PHP Form Processor
<html>
<body>
  <?php
  $quantity = $_POST['quantity'];
  $item = $_POST['item'];
  echo "You ordered ". $quantity . " " . $item . ".<br />";
  echo "Thank you for ordering from ABC Art Supplies!";
  ?>
  </body>
</html>

Mais conteúdo relacionado

Mais procurados (16)

Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Javascript alert and confrim box
Javascript alert and confrim boxJavascript alert and confrim box
Javascript alert and confrim box
 
Popup boxes
Popup boxesPopup boxes
Popup boxes
 
Phpwebdevelping
PhpwebdevelpingPhpwebdevelping
Phpwebdevelping
 
Php notes 01
Php notes 01Php notes 01
Php notes 01
 
Browser As Platform
Browser As PlatformBrowser As Platform
Browser As Platform
 
What are the Benefits of Learning HTML code?
What are the Benefits of Learning HTML code?What are the Benefits of Learning HTML code?
What are the Benefits of Learning HTML code?
 
Intro 1 sept_14_2010
Intro 1 sept_14_2010Intro 1 sept_14_2010
Intro 1 sept_14_2010
 
Html journal chris kweks (microbold)
Html journal   chris kweks (microbold)Html journal   chris kweks (microbold)
Html journal chris kweks (microbold)
 
Learn html in 30mins
Learn html in 30minsLearn html in 30mins
Learn html in 30mins
 
Chapter1 introduction it2
Chapter1 introduction it2Chapter1 introduction it2
Chapter1 introduction it2
 
Html lecture1
Html lecture1Html lecture1
Html lecture1
 
Pre production
Pre productionPre production
Pre production
 
Xhtml
XhtmlXhtml
Xhtml
 
Semantics & the Mobile Web
Semantics & the Mobile WebSemantics & the Mobile Web
Semantics & the Mobile Web
 
Php web development
Php web developmentPhp web development
Php web development
 

Destaque

Why companies need to work agile ?
Why companies need to work agile ?Why companies need to work agile ?
Why companies need to work agile ?Mona Shokrof
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison postervscr429
 
Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]vscr429
 
Level Design Technology Forecast
Level Design Technology ForecastLevel Design Technology Forecast
Level Design Technology ForecastPralie Dutzel
 
Agile for startup success
Agile for startup successAgile for startup success
Agile for startup successMona Shokrof
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison postervscr429
 
Life at GDC - Tech Forum Presentation
Life at GDC - Tech Forum PresentationLife at GDC - Tech Forum Presentation
Life at GDC - Tech Forum PresentationPralie Dutzel
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison postervscr429
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison postervscr429
 
Working time regulations
Working time regulationsWorking time regulations
Working time regulationsStewart Spence
 
Gamification - MDWEgypt 2016
Gamification  - MDWEgypt 2016Gamification  - MDWEgypt 2016
Gamification - MDWEgypt 2016Mona Shokrof
 
Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]vscr429
 

Destaque (19)

Why companies need to work agile ?
Why companies need to work agile ?Why companies need to work agile ?
Why companies need to work agile ?
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison poster
 
Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]
 
Aula10
Aula10Aula10
Aula10
 
Level Design Technology Forecast
Level Design Technology ForecastLevel Design Technology Forecast
Level Design Technology Forecast
 
Agile for startup success
Agile for startup successAgile for startup success
Agile for startup success
 
S.t.a.r.
S.t.a.r.S.t.a.r.
S.t.a.r.
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison poster
 
Life at GDC - Tech Forum Presentation
Life at GDC - Tech Forum PresentationLife at GDC - Tech Forum Presentation
Life at GDC - Tech Forum Presentation
 
S.t.a.r.
S.t.a.r.S.t.a.r.
S.t.a.r.
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison poster
 
S.t.a.r.
S.t.a.r.S.t.a.r.
S.t.a.r.
 
S.t.a.r.
S.t.a.r.S.t.a.r.
S.t.a.r.
 
Language comparison poster
Language comparison posterLanguage comparison poster
Language comparison poster
 
Aula1 2016
Aula1 2016Aula1 2016
Aula1 2016
 
Mm1 mmc
Mm1 mmcMm1 mmc
Mm1 mmc
 
Working time regulations
Working time regulationsWorking time regulations
Working time regulations
 
Gamification - MDWEgypt 2016
Gamification  - MDWEgypt 2016Gamification  - MDWEgypt 2016
Gamification - MDWEgypt 2016
 
Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]Prepositions mini lesson_esl502[1]
Prepositions mini lesson_esl502[1]
 

Semelhante a Php (20)

Php tizag tutorial
Php tizag tutorialPhp tizag tutorial
Php tizag tutorial
 
PHP learning
PHP learningPHP learning
PHP learning
 
php_tizag_tutorial
php_tizag_tutorialphp_tizag_tutorial
php_tizag_tutorial
 
Php tizag tutorial
Php tizag tutorial Php tizag tutorial
Php tizag tutorial
 
Php tizag tutorial
Php tizag tutorialPhp tizag tutorial
Php tizag tutorial
 
PHP.docx
PHP.docxPHP.docx
PHP.docx
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
How to Use PHP in HTML.pdf
How to Use PHP in HTML.pdfHow to Use PHP in HTML.pdf
How to Use PHP in HTML.pdf
 
Basic php 5
Basic php 5Basic php 5
Basic php 5
 
PHP
PHPPHP
PHP
 
Php1
Php1Php1
Php1
 
Php
PhpPhp
Php
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 

Último

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
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 educationjfdjdjcjdnsjd
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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 FMESafe Software
 

Último (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 

Php

  • 1.
  • 2. What is PHP? PHP is an HTML-embedded scripting language. The goal of the language is to allow web developers to write dynamically generated pages quickly.
  • 3. PHP will allow you to:  Reduce the time to create large websites it’s an Open Source Software.  Create a customized user experience for visitors based on information that you have gathered from them
  • 4. What You Should Know Before starting this tutorial it is important that you have a basic understanding and experience in the following: HTML - Know the syntax and especially HTML forms. Basic programming knowledge - This isn't required, but if you have any traditional programming experience it will make learning PHP a great deal easier.
  • 5. PHP Syntax  Syntax: The rules that must be followed to write properly structured code  You can put your PHP code inside the body of HTML  The PHP code is enclosed with <?php //your code here. ?>
  • 6. example <html> <head> <title>Hello in PHP</title> </head> <body> <h1>Hello in PHP</h1> <? echo "Hello, world!“; ?> </body> </html>
  • 7. Example 2: HTML & PHP <html> <head> <title>My First PHP Page</title> </head> <body> <?php echo "Hello World!"; ?> </body> </html>
  • 8. PHP - Variables  A variable is a means of storing a value, such as text string "Hello World!" or the integer value 4. A variable can then be reused throughout your code, instead of having to type out the actual value, over and over again. In PHP you define a variable with the following form: Example: $variable_name = Value; Description: If you forget that dollar sign at the beginning and the semi-colon at the end, it will not work. This is a common mistake for new PHP programmers!
  • 9. Outputting a String.  PHP <?php echo "Hello!"; echo "<h5>I love using PHP!</h5>"; ?>  Output Hello! I love using PHP!
  • 10. Using Comment in PHP  Comments in PHP are similar to comments that are used in HTML. A comment is started with a special character sequence and all text that appears between the start of the comment and the end will be ignored by the browser.  Single Line Comment // this a single line statement  Multiple Line Comment /* this is a multiple line comment. */
  • 11. Creating HTML form <html><body> <h4>ABC Art Supply Order Form</h4> <form> <select> <option>Paint</option> <option>Brushes</option> <option>Erasers</option> </select> Quantity: <input type="text" /> <input type="submit" /> </form> </body></html> Output
  • 12. PHP Form Processor <html> <body> <?php $quantity = $_POST['quantity']; $item = $_POST['item']; echo "You ordered ". $quantity . " " . $item . ".<br />"; echo "Thank you for ordering from ABC Art Supplies!"; ?> </body> </html>