SlideShare a Scribd company logo
Introduction to PHP
PHP Origins 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 ”)  ?>
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  C-like language
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 PHP script Remote services Web Server  (Apache, IIS)‏ Browser (IE, FireFox,  Opera)‏ Desktop  (PC or MAC)‏ Database Database  Server SQL Client application HTTP  HTML Web Service tables DHTML SMS vision touch voice SMS system
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

More Related Content

PPTX
Puva therapy
PPT
slidesharenew1
PPT
Chapter10
PDF
Recent Developments on the Employer's Duty to Accommodate
PPTX
What causes motion
PPTX
Forces
PPTX
Vectors and projectile motion and worked examples
PPT
Newton’s first law of motion
Puva therapy
slidesharenew1
Chapter10
Recent Developments on the Employer's Duty to Accommodate
What causes motion
Forces
Vectors and projectile motion and worked examples
Newton’s first law of motion

Viewers also liked (9)

PPTX
Ultraviolet Radiation (UVR)
PPTX
Forces and their effects
PDF
Force and motion
PPT
force and laws of motion
PPTX
Types of forces
PPS
Forces Ppt
PPTX
Force and Motion Review ppt
PDF
The Top Skills That Can Get You Hired in 2017
Ultraviolet Radiation (UVR)
Forces and their effects
Force and motion
force and laws of motion
Types of forces
Forces Ppt
Force and Motion Review ppt
The Top Skills That Can Get You Hired in 2017
Ad

Similar to Introduction to php (20)

PPT
Introduction to php php++
PPT
345345
PPT
ssfsd fsdf ds f
PPT
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
PPT
sdfsdfsdf
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
IntroductiontoPHP.ppt
PPT
PPT
IntroductiontoPHP.ppt
PPT
PPT
IntroductiontoPHP.ppt
PPT
ssfsd fsdf ds f
Introduction to php php++
345345
ssfsd fsdf ds f
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
sdfsdfsdf
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
IntroductiontoPHP.ppt
ssfsd fsdf ds f
Ad

More from mohamed ashraf (14)

PDF
Seo wordpress
PDF
File9350
PDF
Basic css-tutorial
PPT
Html tutorial
PDF
Html css
PPT
15 03-0460-00-0000-css-tutorial
PPT
Ubi comp27nov04
PPT
Phpwebdevelping
Seo wordpress
File9350
Basic css-tutorial
Html tutorial
Html css
15 03-0460-00-0000-css-tutorial
Ubi comp27nov04
Phpwebdevelping

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding

Introduction to php

  • 2. PHP Origins 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. 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 C-like language
  • 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 PHP script Remote services Web Server (Apache, IIS)‏ Browser (IE, FireFox, Opera)‏ Desktop (PC or MAC)‏ Database Database Server SQL Client application HTTP HTML Web Service tables DHTML SMS vision touch voice SMS system
  • 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