SlideShare une entreprise Scribd logo
1  sur  10
Introduction to PHP
PHP Origins
Rasmus Lerdorf (born Greenland, ed Canada)
PHP originally abbreviation for ‘Personal Home Pages’,
now ‘PHP Hypertext Processor’

Other key developers: Zeev Surashi and Andi Gutmans
(Israel)
Open Source

PHP version 4.4.3 current at UWE
Due to upgrade to PHP 5
Scripting languages
• A scripting language is:
–
–
–
–
–
–
–
–
–

often evolved not designed
cross-platform since interpreter is easy to port
designed to support a specific task – PHP -> Web support
un-typed variables (but values are typed)
implicit variable declaration
implicit type conversion
stored only as script files
compiled on demand
may run on the server (PHP) or the client (Javascript)

• What design and development are involved in using a
scripting language like PHP for development in place of
a compiled language (Java in JSP, .NET)?
PHP details
• Procedural language
– Compare with Javascript which is event-driven

• C-like syntax - { } ;
• Extensive Function Library
• Good Web-server integration
– Script embedded in HTML
– Easy access to form data and output of HTML pages

• Not fully object-oriented
– Java is fully object oriented – all functions have to be
in a class
– In PHP, classes are additional but quite simple to use
PHP and HTML
• HTML-embedded
– PHP scripts are essentially HTML pages with
the occasional section of PHP script.
– PHP script is enclosed in the tag pair:
•

<?php print date(“H:I”) ?>
C-like language
•
•
•
•
•
•
•
•
•
•
•

Free format - white space is ignored
Statements are terminated by semi-colon ;
Statements grouped by { … }
Comments begin with // or a set of comments /* */
Assignment is ‘=’: $a=6
Relational operators are ,< , > == ( not a single equal)
Control structures include if (cond) {..} else { }, while (cond) { .. } ,
for(sstartcond; increment; endcond) { }
Arrays are accessed with [ ] : $x[4] is the 5th element of the array
$x – indexes start at 0
Associative Arrays (hash array in Perl, dictionary in Java) are
accessed in the same way: $y[“fred”]
Functions are called with the name followed by arguments in a fixed
order enclosed in ( ) : substr(“fred”,0,2)
Case sensitive - $fred is a different variable to $FRED
Function library
• Basic tasks
–
–
–
–
–

String Handling
Mathematics – random numbers, trig functions..
Regular Expressions
Date and time handling
File Input and Output

• And more specific functions for– Database interaction –
• MySQL, Oracle, Postgres, Sybase, MSSQL ..

–
–
–
–
–

Encryption
Text translation
Spell-checking
Image creation
XML
String Handling
• String literals (constants) enclosed in double quotes “ ”
or single quotes ‘ ’
• Within “”, variables are replaced by their value: – called
variable interpolation. “My name is $name, I think”
• Within single quoted strings, interpolation doesn’t occur
• Strings are concatenated (joined end to end) with the
dot operator “key”.”board” == “keyboard”
• Standard functions exist: strlen(), substr() etc
• Values of other types can be easily converted to and
from strings – numbers implicitly converted to strings in a
string context.
• Regular expressions be used for complex pattern
matching.
3(+1) Tier architecture
voice
DHTML

touch

Browser
(IE, FireFox,
Opera)

vision

HTTP

SQL
PHP script

HTML

Web Server
(Apache, IIS)

Database
tables

Desktop
(PC or MAC)

Database
Server

SMS
Web Service
SMS system

Client application

Remote services
Learning PHP
• Start with just the basics, installing a script
to output an HTML page
• Understand how PHP supports interaction
with the Browser or other clients
• Understand how PHP supports integration
with databases – MySQL
• Understand how PHP supports integration
with other applications – Web services

Contenu connexe

Tendances (20)

PHP
PHPPHP
PHP
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Class 3 - PHP Functions
Class 3 - PHP FunctionsClass 3 - PHP Functions
Class 3 - PHP Functions
 
PHP Basic
PHP BasicPHP Basic
PHP Basic
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Basic PHP
Basic PHPBasic PHP
Basic PHP
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
Data Types In PHP
Data Types In PHPData Types In PHP
Data Types In PHP
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php Lecture Notes
Php Lecture NotesPhp Lecture Notes
Php Lecture Notes
 

Similaire à Introduction to php php++

Similaire à Introduction to php php++ (20)

Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
test
testtest
test
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
ssfsd fsdf ds f
ssfsd fsdf ds fssfsd fsdf ds f
ssfsd fsdf ds f
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
ssfsd fsdf ds f
ssfsd fsdf ds fssfsd fsdf ds f
ssfsd fsdf ds f
 
ssfsd fsdf ds f
ssfsd fsdf ds fssfsd fsdf ds f
ssfsd fsdf ds f
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
ssfsd fsdf ds f
ssfsd fsdf ds fssfsd fsdf ds f
ssfsd fsdf ds f
 
ssfsd fsdf ds f
ssfsd fsdf ds fssfsd fsdf ds f
ssfsd fsdf ds f
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
hgfgf
hgfgfhgfgf
hgfgf
 
IntroductiontoPHP.ppt
IntroductiontoPHP.pptIntroductiontoPHP.ppt
IntroductiontoPHP.ppt
 
test
testtest
test
 
sdfsdfsdf
sdfsdfsdfsdfsdfsdf
sdfsdfsdf
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 
345345
345345345345
345345
 

Dernier

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Dernier (20)

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 

Introduction to php php++

  • 2. PHP Origins Rasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key developers: Zeev Surashi and Andi Gutmans (Israel) Open Source PHP version 4.4.3 current at UWE Due to upgrade to PHP 5
  • 3. Scripting languages • A scripting language is: – – – – – – – – – often evolved not designed cross-platform since interpreter is easy to port designed to support a specific task – PHP -> Web support un-typed variables (but values are typed) implicit variable declaration implicit type conversion stored only as script files compiled on demand may run on the server (PHP) or the client (Javascript) • What design and development are involved in using a scripting language like PHP for development in place of a compiled language (Java in JSP, .NET)?
  • 4. PHP details • Procedural language – Compare with Javascript which is event-driven • C-like syntax - { } ; • Extensive Function Library • Good Web-server integration – Script embedded in HTML – Easy access to form data and output of HTML pages • Not fully object-oriented – Java is fully object oriented – all functions have to be in a class – In PHP, classes are additional but quite simple to use
  • 5. PHP and HTML • HTML-embedded – PHP scripts are essentially HTML pages with the occasional section of PHP script. – PHP script is enclosed in the tag pair: • <?php print date(“H:I”) ?>
  • 6. C-like language • • • • • • • • • • • Free format - white space is ignored Statements are terminated by semi-colon ; Statements grouped by { … } Comments begin with // or a set of comments /* */ Assignment is ‘=’: $a=6 Relational operators are ,< , > == ( not a single equal) Control structures include if (cond) {..} else { }, while (cond) { .. } , for(sstartcond; increment; endcond) { } Arrays are accessed with [ ] : $x[4] is the 5th element of the array $x – indexes start at 0 Associative Arrays (hash array in Perl, dictionary in Java) are accessed in the same way: $y[“fred”] Functions are called with the name followed by arguments in a fixed order enclosed in ( ) : substr(“fred”,0,2) Case sensitive - $fred is a different variable to $FRED
  • 7. Function library • Basic tasks – – – – – String Handling Mathematics – random numbers, trig functions.. Regular Expressions Date and time handling File Input and Output • And more specific functions for– Database interaction – • MySQL, Oracle, Postgres, Sybase, MSSQL .. – – – – – Encryption Text translation Spell-checking Image creation XML
  • 8. String Handling • String literals (constants) enclosed in double quotes “ ” or single quotes ‘ ’ • Within “”, variables are replaced by their value: – called variable interpolation. “My name is $name, I think” • Within single quoted strings, interpolation doesn’t occur • Strings are concatenated (joined end to end) with the dot operator “key”.”board” == “keyboard” • Standard functions exist: strlen(), substr() etc • Values of other types can be easily converted to and from strings – numbers implicitly converted to strings in a string context. • Regular expressions be used for complex pattern matching.
  • 9. 3(+1) Tier architecture voice DHTML touch Browser (IE, FireFox, Opera) vision HTTP SQL PHP script HTML Web Server (Apache, IIS) Database tables Desktop (PC or MAC) Database Server SMS Web Service SMS system Client application Remote services
  • 10. Learning PHP • Start with just the basics, installing a script to output an HTML page • Understand how PHP supports interaction with the Browser or other clients • Understand how PHP supports integration with databases – MySQL • Understand how PHP supports integration with other applications – Web services