Professional Documents
Culture Documents
Carl-Erik Svensson
What is PHP?
• PHP is a widely-used general-purpose
scripting language that is especially suited
for Web development and can be
embedded into HTML*
*Source: http://www.php.net
Why Use PHP?
• Simple, yet powerful
scripting tool
• It is popular
Image Source:
http://www.securityspace.com/s_survey/data/man.200709/apachemods.html
The Basics
The Results
• Output from a script
goes directly into the
HTML that is parsed
• This is what is
meant by a
‘dynamic’ webpage
Some Syntax
• Generally C-like
• Variables are not strongly typed
Web Applications
• Form processing
• Database manipulation
– Blogs
– Forums
– Facebook
PHP + MySQL = Sweet
• MySQL is an open source database
software solution
• Enables rich web applications when
combined with PHP
http://128.174.242.224/PHPExamples/rainfall.php
A Slight Improvement
• This was not the exact code we came
up with
• I added some titles and a neat trick
– Highlight every other row in the table
– This makes information more readable
Samples
• USGS Example Rainfall
• EC Awards Committee Scholarship
Database
What Else Can PHP Do?
• Command line scripting
• Desktop applications
• Anything
Links
• PHP.net
• PHP Manual
• MySQL