Beruflich Dokumente
Kultur Dokumente
Jeff Jirsa
jjirsa@xnet.com
Agenda
– Introduction
– PHP Language Basics
– Built-in Functions
– PHP on Linux and Windows
– Tricks and Tips
– PHP 5
– Examples
– Questions?
Introduction
• What is PHP?
– PHP stands for "PHP Hypertext
Preprocessor”
– An embedded scripting language for HTML
like ASP or JSP
– A language that combines elements of
Perl, C, and Java
Introduction
• History of PHP
– Created by Rasmus Lerdorf in 1995 for
tracking access to his resume
– Originally a set of Perl scripts known as the
“Personal Home Page” tools
– Rewritten in C with database functionality
– Added a forms interpreter and released as
PHP/FI: includes Perl-like variables, and
HTML embedded syntax
Introduction
• Performance*
– Zdnet Statistics
• PHP pumped out about 47 pages/second
• Microsoft ASP pumped out about 43 pages/second
• Allaire ColdFusion pumped out about 29
pages/second
• Sun Java JSP pumped out about 13 pages/second
echo $arr["somearray"][6]; // 5
echo $arr["somearray"][13]; // 9
echo $arr["somearray"]["a"]; // 42
?>
PHP Language Basics
$ConfigFile = "$ConfigPath/paperwork.conf";
$CountryList = "$DataPath/countries.txt";
$StateAbbrList = "$DataPath/usstateabbrs.txt";
$StateNameList = "$DataPath/usstatenames.txt";
Tricks and Tips
• Coding
– Prototype your web pages first
• Separate the design of the site from the coding
– Turn repetitive code into functions
• Makes for more maintainable and reusable
code
– Turn grunt code into functions
• Database access, configuration file access
Tricks and Tips
• Debugging
– Feature: PHP is not a strongly typed
language
• Variables can be created anywhere in your
code
– Undocumented Feature: PHP is not a
strongly typed language
• Typos in variable names will cause stuff to
happen
Tricks and Tips
• Debugging
– Use scripts to dump form and session
variables
• Write scripts to dump data to discover bad or
missing data
Tricks and Tips
• Development Tools
– Color coding editors
• vim, Emacs, Visual SlickEdit
– IDEs
• Windows
– Macromedia Dreamweaver
– Allaire Homesite
– Zend’s PHPEdit
• Linux
– ???
PHP 5
• Release Date
– ???
• Features
– Complete objects
• Objects with constructors
• Abstract classes
• Private, protected and abstract functions
• Private, protected and constant variables
• Namespaces
• Exception handling with try/catch blocks
Resources
– Any Questions
• www.php.net
– Community
• www.phpbuilder.com: articles on PHP,
discussion forums
– Newsgroups
• comp.lang.php