General Comparison

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1.

PHP-HYPERTEXT PREPROCESSOR PHP: Hypertext Preprocessor is a widely


used, general-purpose scripting language that was originally designed for web
development to produce dynamic web pages. For this purpose, PHP code is embedded
into the HTML source document and interpreted by a web server with a PHP processor
module, which generates the web page document. As a general-purpose programming
language, PHP code is processed by an interpreter application in command-line mode
performing desired operating system operations and producing program output on its
standard output channel. It may also function as a graphical application. PHP is
available as a processor for most modern web servers and as standalone interpreter on
most operating systems and computing platforms. PHP was originally created by
Rasmus Lerdorf in 1995 and has been in continuous development ever since. The main
implementation of PHP is now produced by The PHP Group and serves as the de facto
standard for PHP as there is no formal specification. PHP is free software released
under the PHP License.

General comparison
The following table compares general and technical information for a selection of commonly
used programming languages. See the individual languages' articles for further information.

1989, ANSI C89, ISO


C System[11] imperative, procedural
C90/C99
Application; imperative, procedural, object-oriented,
C++
System generic

This article is about the scripting language. For other uses, see PHP (disambiguation).

imperative, object-oriented,
Paradigm
Procedural, reflective

Appeared in 1995; 16 years ago[1]

Designed by Rasmus Lerdorf


Developer The PHP Group

Stable release 5.3.5 (January 6, 2011; 41 days ago)

Typing discipline Dynamic, weak

Zend Engine, Phalanger, Quercus,


Major implementations
Project Zero, HipHop

Influenced by C, Perl, Java, C++, Tcl[1]

Influenced PHP4Delphi

Implementation
C
language

OS Cross-platform

License PHP License

Usual file extensions .php, .phtml .php5 .phps

Website php.net

PHP Programming at Wikibooks

PHP: Hypertext Preprocessor (a recursive acronym, originally personal home page) is a


general-purpose scripting language that was originally designed for web development to produce
dynamic web pages. For this purpose, PHP code is embedded into the HTML source document
and interpreted by a web server with a PHP processor module, which generates the web page
document. As a general-purpose programming language, PHP code is processed by an interpreter
application in command-line mode performing desired operating system operations and
producing program output on its standard output channel. It may also function as a graphical
application. PHP is available as a processor for most modern web servers and as a standalone
interpreter on most operating systems and computing platforms.
PHP was originally created by Rasmus Lerdorf in 1995[1][2] and has been in continuous
development ever since. The main implementation of PHP is now produced by the PHP Group
and serves as the de facto standard for PHP as there is no formal specification.[3] PHP is free
software released under the PHP License.

A web page or webpage is a document or information resource that is suitable for the World
Wide Web and can be accessed through a web browser and displayed on a monitor or mobile
device. This information is usually in HTML or XHTML format, and may provide navigation to
other web pages via hypertext links. Web pages frequently subsume other resources such as style
sheets, scripts and images into their final presentation.

A dynamic web page is a kind of web page that has been prepared with fresh information
(content and/or layout), for each individual viewing. It is not static because it changes with the
time (ex. a news content), the user (ex. preferences in a login session), the user interaction (ex.
web page game), the context (parametric customization), or any combination of the foregoing.

Scripting vs.
Programming Languages

There is no clearly defined


difference between
scripting languages and
programming languages.
Functionally, they are
equivalent. Languages tend
to be called scripting
languages if they possess
certain characteristics:

 relatively easy to use,


compared to
traditional languages
like C
 run inside another
program
 interpreted rather
than compiled

PHP arguably has all of


these characteristics ...
however, it's still perfectly
acceptable to tell people
you're programming in
PHP, if you want to.

PHP is very flexible: Simple PHP functions can be embedded within web pages, or it can work
the other way: HTML code can be embedded within PHP. We'll cover that in more detail in a bit.

PHP is very versatile: it can talk to a variety of external applications using a wide variety of
protocols, and it can parse (understand) a wide range of data interchange formats.

For example, it can talk to database programs like MySQL and Oracle, as well as smaller-scale
database programs like MS Access and Filemaker. That makes it very useful for developing
database-driven web applications. It can also talk to things like LDAP servers (for user
information) and, in the library world, Z39.50 servers, and numerous other things. Unfortunately,
we won't have time to cover interacting with databases in this class.

PHP has modules that can parse XML, various forms of delimited content, and of course, our old
friend MARC.

PHP is now a recursive acronym, that stands for "PHP Hypertext Preprocessor" ... but it didn't
always.

Origin and History

PHP originally stood for Personal Home Page Tools. It began in 1994 as a set of programs
written by programmer Rasmus Lerdorf, that he used to perform tasks related to the maintenance
of his personal home page, such as displaying his résumé. Lerdorf released PHP publicly on June
8, 1995 to accelerate bug location and improve the code.This release was named PHP version 2
and already had the basic functionality that PHP has today. This included variables, form
handling, and the ability to embed HTML.

Versions

PHP 3.0 was the first version that closely resembles PHP as we know it today. It was created by
Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite, after they found PHP 2.0
severely underpowered for developing an eCommerce application they were working on. In an
effort to cooperate and start building upon PHP existing user-base, Andi, Rasmus and Zeev
decided to cooperate and announce PHP 3.0 as the official successor. This is also when the
acronym took on its current meaning.

One of the biggest strengths of PHP 3.0 was its strong extensibility features. PHP 3.0's
extensibility features attracted dozens of developers to join in and submit new extension
modules. Arguably, this was the key to PHP 3.0's tremendous success. (And it's why PHP can
talk Z39.50 and MARC, which are of interest to only a vanishingly small percentage of its user
base).
PHP 4.0 was officially released in May 2000, following a rewrite of its core engine (the Zend
engine), which dramatically improved its performance. A huge upswell of PHP adoption
followed this release, and today you'll still find many useful applications written in PHP 4, even
though it's been 4 years since PHP5 went into general release.

PHP 5 was released in July 2004 after long development. It contained numerous new features
and a few big changes, but we won't bother to enumerate them here because they wouldn't be
relevant to an introductory class. The most important fact to note about PHP5 at this stage is that
it is mostly, but not completely, backwards-compatible with version 4.

For the past 4 years, PHP4 has continued to be supported by the PHP development team.
However, the last official patch for PHP4 was released in August 2008, so we can anticipate that
its availability will be increasingly limited from here on in (that is, limited to servers whose
admins don't care that much about security). This would be important to consider if, for example,
you were considering deploying an application that had not been tested under version 5. And
your development environment should be PHP5, although at this stage of the game it doesn't
matter much.

PHP6 is in development, but no date has yet been set for its release.

Why PHP?

It's true ... PHP is not the only game in town. Truth be told, there are a plethora of tools that do
similar things. In the Microsoft realm, there's ASP (and more recently, ASP.net). In the Java
realm, there's JSP. And there are even a lot of open source alternatives, including stalwarts like
Perl, and upstarts like Ruby (and its highly successful framework, Ruby on Rails).

So why focus on PHP, rather than one of those other options? PHP combines a number of
advantages that are pretty hard to beat: it's free (unlike ASP), it's relatively easy to learn (unlike
JSP), it's built for the web from the ground up (unlike Perl), and it's darn near ubiquitous (unlike
Ruby). Also, your instructors have done a fair amount of work in PHP, and not so much with
some of the alternatives, except maybe Perl.

Documentation

The main source of documentation for PHP is http://php.net. This site contains a wealth of
information, including a tutorial, faq, software downloads, and the main reference work, the PHP
Manual, which is where you'll be spending most of your time if you take up PHP development
seriously.

If you're looking for a good introductory text, there are plenty to choose from. You might try
Learning PHP5, by David Sklar. PHP Programming for the World Wide Web: Visual
QuickStart Guide (2nd Edition) by Larry Ullman is another practical book on introductory to
intermediate PHP programming that's worth a look.
Most of the foregoing introductory material has been freely cribbed from the official PHP site,
and the PHP Wikipedia entry.

You might also like