PHP programming language
For the "PHP" Cold-war history project, see Parallel History Project.PHP (now a recursive acronym for "PHP Hypertext Preprocessor", but originally "Personal Home Page Tools"; also often referred to as "Professional Homepages" and "Pre-Hypertext Processor") is a widely used open-source programming language used primarily for server-side applications, to develop dynamic web content such as the phpBB software. It can be seen as an alternative to Microsoft's ASP/VBScript/JScript system, Sun Microsystems' JSP/Java system, and to the CGI/Perl system.
Its ease of use and similarity with the most common structured programming languages, most notably C and Perl, allows most experienced programmers to start developing complex applications with a minimal learning curve. It also enables experienced developers to get involved with dynamic web content applications without having to learn a whole new set of functions and practices.
One of the more attractive parts of PHP is that it is more than just a scripting language. Thanks to its modular design, PHP can also be used to develop GUI applications, and it can be used from the command line just like Perl or Python can be.
PHP allows, among other things, easy interaction with a large number of relational database systems (Oracle, DB2, MySQL, PostgreSQL, etc.), while maintaining a simple and straightforward syntax. PHP runs on every major operating system, including Unix, Linux, Windows, and Mac OS X and can interact with all major web servers. The official PHP website contains extensive online documentation. The Linux, Apache, MySQL, PHP¹ (LAMP) architecture has become very popular in the industry as a way of cheaply deploying reliable, scalable, and secure web applications. (It should be noted that the 'P' in LAMP can also stand for Perl or Python.)
PHP is the result of the collective efforts of many contributors. It is licensed under a BSD-style license, the PHP license. PHP 4 and 5 engines are powered by Zend Technologies.
| Table of contents |
|
2 Object orientation 3 History 4 Popularity of PHP 5 Code Examples 6 Software built with PHP 7 See also 8 External links |
PHP, unlike ASP and Perl, has some of the largest free and open-source libraries included with the core build. PHP is a fundamentally internet-aware system and as such there are modules built in for accessing FTP servers, all manners of database servers, LDAP servers and much more. In addition to this, many familiar C functions such as printf() and strstr() are all available in the core namespace.
PHP has a wide variety of extensionss such as support for the Windows API, process management on Linux, cURL support, ZIP, gzip and bzip2 support. Some of the more unique features are PDF generation, Macromedia Flash generation (on the fly), integration with IRC and much more besides.
This is the present list of all officially documented libraries:
PHP's libraries
|
Ingres II
|
Printer
|
(Source: PHP.net manual)
Up until version 4 PHP had no object-oriented (OO) features. In version 4 basic OO functionality was added, but the implementation still lacked the powerful and useful features of other OO programming languages like C++ and Java.
In version 5, which is currently in development, PHP's OO functionality has been very much enhanced and is more robust and complete. Here is a summary of some of the changes in PHP 5 (powered by Zend Engine 2):
;New Object Model.
Object orientation
;Private and Protected Members
;Private and protected methods
;Abstract Classes and Methods
;Interfaces
;Object Cloning
;Unified Constructors
;Destructors
;Exceptions
For more additions and examples of the additions mentioned above, please visit this page.
PHP was originally designed as a wrapper around Perl by Rasmus Lerdorf in 1994 to display his resume information and collect some data, such as how many hits it was generating. Others first used "Personal Home Page Tools" in 1995, which Lerdorf had combined 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, forming the basis of PHP 3. They also changed the name to its current recursive form. After months in beta, the development team officially released PHP/FI 2 in November 1997. Public testing of PHP 3 began immediately and the official launch came in June 1998. Suraski and Gutmans started a new rewrite of PHP's core, producing the Zend engine in 1999. In May 2000, PHP 4 powered by the Zend Engine was released. Development continues toward PHP 5 with Zend Engine 2.78.
PHP is one of the most popular server-side scripting systems on the Web. It's been widely adopted since the release of version 4, which was the first version powered by the powerful Zend Engine from Zend Technologies.
One major part of PHP which has helped it become popular is that it is a very loose language. That is, the rules aren't as strict with variables and the like. For example, you never need to declare a variable and they can be of any type. All variables start with the "$" sign. Also, arrays can be created and then hold anything in them. Unlike many other languages (like C++ and Java) they will be able to hold different variable types, and even other arrays if you so desire. All of this "loose-ness" makes it very easy to do many things.
According to Netcraft's April 2002 survey, PHP is now the most-deployed server-side scripting language, running on around 9 million of the 37 million domains in their survey. This is confirmed by PHP.net's own figures, which show PHP usage measured on a per-domain basis growing at around 5% per month. In May 2003, almost 13 million domains were using PHP, based on the same source. [1]
However, PHP is not the most commonly used tool if measurements are made on a per-page basis. Another estimate in March 2002, based on searching for Web pages by their suffix, places PHP in second place at 30% of measured pages, behind 48% using Microsoft's ASP, but also shows PHP growing rapidly in market share. However, this method is notoriously inaccurate for measuring PHP popularity as some PHP systems dispense with the file names, using only directories, while other sites (like Wikipedia) tend to dispense with the .php extension. Likewise, many dynamic content websites access data from databases or source-files and the PHP pages required to access data may be minimal though the quantity of information (viewable pages) is immense.
Due to PHP's popularity, a new breed of programmers has emerged who are only familiar with PHP, which in turn forced open the door towards a command line interface for PHP, along with support for GUI functions, such as GTK+ or ncurses support. This is a major step for PHP, because it represents its adoption as a genuine programming language (i.e. running autonomously on a stand-alone machine, as opposed to its original purpose of serving web pages to client machines from a server).
/* This is another style for commenting */
// Sets the variable $variable
$variable = "hello world";
// Lines in PHP that aren't comments or closing braces are ended with semicolons
print $variable;
echo $variable;
// Both print and echo have the same effect, displaying the specified variable
History
Popularity of PHP
Code Examples
// This is one style for commenting
Software built with PHP
See also
External links
Programming languages
Ada | Algol | APL | BASIC | C | C++ | C# | Cg | COBOL | Common Lisp | ColdFusion | Delphi | Eiffel | Forth | FORTRAN | Haskell | Java | JavaScript | Jython | Lisp | Logo | Mesa | ML | Modula-2 | Oberon | Objective-C | Objective Caml | Pascal | Perl | PHP | PL/I | PostScript | Powerbuilder | Prolog | Python | QBASIC | REXX | Ruby | Scheme | Smalltalk | Tcl/Tk | Visual Basic