SPSC
Home  Contact Us  Site Map 

PHP


PHP Overview

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

PHP was originally designed as a small set of Perl scripts, followed by a rewritten set of CGI binaries written in C by the Danish-Canadian programmer Rasmus Lerdorf in 1994 to display his résumé and to collect certain data, such as how much traffic his page was receiving. "Personal Home Page Tools" was publicly released on 8th June 1995 after Lerdorf combined it with his own Form Interpreter to create PHP/FI. Zeev Suraski and Andi Gutmans, two Israeli developers of the Technion - Israel Institute of Technology, rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to its current recursive form (PHP: Hypertext Preprocessor). The development team officially released PHP/FI 2 in November 1997 after months of beta testing. Public testing of PHP 3 began immediately and the official launch came in June 1998. Suraski and Gutmans then started a new rewrite of PHP's core, producing the Zend engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel which has since overseen the PHP advances. In May 2000, PHP 4, powered by the Zend Engine 1.0, was released. On July 13, 2004, PHP 5 was released, powered by Zend Engine II (formerly known as Zend Engine 2). PHP 5 includes new features such as PHP Data Objects (PDO) and more performance enhancements taking advantage of the new Zend Engine II.

SPSC Contributors: Peter Kroeger


This page is currently not completed. The SPSC Knowledge Working Group is lookig for a PHP expert to provide content for this page. If you are interested in contributing to this service please email office@softwareprofessionals.ca or visit our Opportunities page. Thank you.

Syntax

<?php ...PHP code... ?>

$variable_name

statements end with a ';'. Use { } to group statements.

if(expr) statement else statement

PHP Keywords

For a complete list see http://www.php.net/manual/en/reserved.php.

keywordpurpose
break
continue
declare
do-while
echo()outputs one or more strings
else
elseif
for
foreach
function
if
include()includes and evaluates the specified file
include_once()
return
require()
require_once()
switch
while

*Note that keywords like echo() do not actually require () around its parameter(s).

PHP 5 Keywords


keywordpurpose
class
extends
new
var

Ref

For a full reference see http://www.php.net/manual/en/langref.php.

Embedding in HTML

PHP is embedded inside HTML pages inside <?php and ?>.

Comments

PHP uses C/C++ style comments. // indicates the rest of the line is a comments. /* and */ indicate that all the text between them is a comment.

Variables

Variable begin with $ followed by a letter or underscore. Variable names are case sensitive and their type is determined by their context. Note than several reserved variables begin with underscore.

Examples

<html>
  <head>
    <title>PHP Test</title>
  </head>
  <body>
  <?php echo '<p>Hello World</p>'; ?>
  </body>
</html>

Please email feedback@softwareprofessionals.ca any suggestions or corrections.
Copyright © 2003 Software Professionals Society of Canada. All rights reserved.