Académique Documents
Professionnel Documents
Culture Documents
Julie Scott
OIT, Faculty Support
Program Lead, Learning Technology
What is PHP?
• PHP = Hypertext Preprocessor
• Why not HP or HPP?
• PHP is a recursive acronym.
• An acronym in which the first letter of the
first word represented by the acronym is
the acronym itself.
• For example: GNU “GNU is Not UNIX!”
More….What is PHP?
• An open source, server-side, HTML
embedded scripting language.
• It is used to create dynamic Web pages.
• PHP script is enclosed within special PHP
tags.
• This allows you to jump between HTML
and PHP.
1
More….What is PHP?
• PHP is executed on the server.
• The client cannot view the PHP code.
• PHP can perform any task that any CGI
program can do.
• Its strength lies in its compatibility with
many types of databases.
• Also, PHP can talk across networks using
IMAP, SNMP, NNTP, POP3, or HTTP
Learning PHP
• Some Books
2
Learning PHP
• Online Tutorials
• Zend http://www.zend.com/zend/tut/
• PHP.net
• Dev Shed:
http://www.devshed.com/c/b/PHP/
• PHP and Postgres
http://pgsql.designmagick.com/
PHP Editors
• Dreamweaver MX in code view
• Homesite
Free editors
• PHP Edit (Windows)
• BBEdit Lite (Macintosh)
###################
# another comment #
###################
3
More….Basic PHP
• Variable names begin with a “$” sign and
are case sensitive
• Function names are NOT case sensitive
• Class names are NOT case sensitive
• Data can be stored in arrays
• Arrays are associative or indexed
• Arrays can have more than one data type
More….Basic PHP
• Variables can be local or global
– Global variables can be used anywhere
– Local variables are local to a function or class
• Most variables are treated as strings
• Special variables exist
– Server variables
– Form variables
– Session variables
WMU Specifics
• wwwtest.wmich.edu
• For SQL database access contact Derek
– We support PostgreSQL
– Note most online tutorials use mySQL
• You can read and write flat files
– Files must be protected so the server can
read and write to them
4
Some Examples
• Reading and Writing Flat Files
– http://www.wmich.edu/~scott/
– (click on the PHP-Workshop Link)
– http://www.wmich.edu/itc/workshops
• Check WebCT workshop registeration
Exercise One
<body>
<?php
$today = "Wednesday" ;
echo " <h2>Hello World</h2>";
echo " Today is $today";
echo phpinfo();
?>
</body>