WHAT IS PHP? General purpose Server-side web development
Console application
Slide 3
BACKGROUND First created in 1994 by Rasmus Lerdorf Designed to
streamline web tasks Designed to access databases for storing data.
Used for web forms First public release in 1995
Slide 4
BACKGROUND Used primarily as website scripting Text
Interpreter/filter Installed on over 20 million websites and
domains Can install multiple versions Current version 5.4
Object-Oriented
Slide 5
HISTORY Originally named Personal Homepage Tools Rewritten in
1997 using C, released publicly Renamed to Hypertext Preprocessor
Version 4 introduced command line functionality Version 5 rewrote
Object support Version 6 has been postponed
Slide 6
LICENSING Open source PHP License Term PHP cannot be used
directly in a project.
Slide 7
OPERATING ENVIRONMENTS Windows Mac Linux Almost any others
Built from source Web servers Apache IIS Lighttpd
Slide 8
STACKS Comes bundled with many Linux Distributions Bundles for
Mac: MAMP (Mac, Apache, MySQL, PHP) Linux: LAMP (Linux, Apache,
MySQL, PHP) Windows: WAMP
Slide 9
HOW IT WORKS Client Request sent to Web server Web server
directs to PHP filter PHP processes data and sends to web server
Web server sends back to client
Slide 10
SYNTAX Similar to major programming languages C Java Can be
embedded inside other languages such as HTML
Slide 11
SYNTAX : DECLARATIONS Declared PHP code with delimiters ASP
Style Code is only executed between these delimiters
Slide 12
SYNTAX: VARIABLES Loosely typed, unlike C/Java // Create an
integer and set equal to 3 $myVariable = 3; Prefixed name with $
Notice no type specified, this can be a string value of 3,
character 3 or integer value of 3. Depends upon notation! Need to
be careful with variable types!
Slide 13
SYNTAX: COMMENTING Similar to other langues // This is a single
line comment /* This is a block style comment */
Slide 14
SYNTAX: FUNCTIONS Functions declarations similar to C/Java
Function myFunction($value1, $value2) { return $value1 + $value2; }
Can be value returning or not!
Slide 15
SYNTAX: LOOPS Similar to C/Java For While Do While for each $i
= 0; While ( $i != 5 ) { echo Number is: . $i. ; $i++; } Notice the
.!
Slide 16
SYNTAX: FILE HANDLING Can Open and write to file system Used to
read/write from a server for web content Built in file support for:
XML FTP Zip Cookies
Slide 17
SYNTAX: GET/POST Can get data using $_Get[ ] Useful for
retrieving data from url. Can send data using $_Post[ ] Useful for
submitting user forms such as request information forms.
Slide 18
SYNTAX: OBJECTS PHP is Object-Oriented Can create classes and
objects of any type Similar to C/Java Can have private/public
methods and data members Arrow notation instead of dot
notation
Slide 19
SYNTAX: MAIL Built in Email support Create text based email
Send via 1 function.
Slide 20
FILE EXTENSIONS Standard extension:.php Can have others .phtml
.php5 If multiple versions are installed,.php5 will refer to
version 5 installed
Slide 21
USAGE Command line Dynamic websites Content Management Can be
used for Desktop applications GUI controls
Slide 22
DATABASE SUPPORT Built to work primarily with MySQL Capable of
working with others: MS SQL Oracle Postgres PDO Driver
Slide 23
SECURITY Very little security holes have been found with core
PHP application Security risks come from each individual
programmer, not the PHP filter! Bad programming habits
Slide 24
WEB PRESENCE 20 Million domains/websites Comes pre installed
with many Linux distributions. Content Management Systems
Slide 25
WEB PRESENCE: CMS Many Content Management Systems are built
with PHP Joomla Wordpress Drupal Far more built with PHP than
others such as.Net
Slide 26
COMMUNITY SUPPORT Need help? Google it. Since PHP is so widely
used, there is great community support Content Management Systems
are sometimes community built
Slide 27
SCRIPT AVAILABILITY Community Support Open Source
http://www.hotscripts.com http://www.hotscripts.com
Slide 28
DEVELOPMENT Code in Notepad IDE Support Netbeans Zend Studio
Eclipse Codelobster
Slide 29
CONCLUSION General Scripting lanaguage Over 20 million domains
Command line/Web server-side Various database support Thousands of
pre-built scripts Open source