Introduction to PHP language

Rasmus LERDORF invented the PHP language in 1995 for his personal use (online his CV in this case). Once an abbreviation of Personal HomePage, now Hypertext Preprocessor, PHP is a standard in the world of web programming for its performance, reliability, flexibility, and speed.


PHP was initially invented for the development of dynamic web applications that still constitute the most common use case and its strong point. However, the evolutions that have been made to date ensure PHP a significant versatility. PHP is, for example, able to interact with Java, generate PDF files, execute Shell commands, manage objects (in the sense of object-oriented programming), create images or provide graphical interfaces using PHP GTK.

In this presentation of the language, we will first introduce the characteristics of PHP; then we will see how it is particularly adapted to web application development. We will then synthesize the other types of possible applications aec PHP before finishing on the limits that we can blame it.

PHP language features


PHP is, first of all, an interpreted script language (actually precompiled into Opcode), free, OpenSource and distributed under a license allowing modification and redistribution.


PHP is supported on several operating systems. This is, for example, the case for Microsoft versions of Windows™, but also methods based on UNIX (Apple MAC OS X™, Linux distributions or Sun Solaris).

It will then be straightforward to move an application written in PHP from an original Windows server to a Linux server without having to modify it (or very little).


From an execution point of view, PHP needs a web server to work. All the pages requested by a client will be built by the Web server, according to the parameters transmitted, before being returned to the client. The diagram below illustrates the working principle of PHP.

Learning PHP

PHP is a “high level” language whose syntax is very close to the C language. This syntax close to natural language ensures fast learning and few constraints of code writing. However, mastering its grammar quickly does not mean learning its features and concepts. Excellent knowledge and advanced use of PHP programming require a relatively long learning time.

Rich PHP language

php 7
Latest version available php 7

One of the strengths of the PHP language is its richness regarding features. Indeed, it initially has more than 3,000 native functions ready for use, guaranteeing developers additional and sometimes tedious development time. These functions allow, among other things, to process strings, mathematically operate on numbers, convert dates, connect to a database system, manipulate files on the server…

PHP also draws its wealth from the dynamism of its developer community. It was estimated at around 500 000 people in 2003, but it is very likely that it has now exceeded one million. Community developer profiles are very diverse. There are those who bring new features and libraries from version to version, those who translate documentation into several languages or even programmers with more modest skills who create ready-to-use Opensources applications. Among the best known, we can quote CMS (Joomla, SPIP, Dotclear, WordPress…), online sales systems (OSCommerce), forums (PHPBB, IPB, VBulletin), frameworks (Zend Framework, Symfony, CakePHP, Jelix)…

PHP, a reliable and powerful language

Language has now become a reliable, robust and viable language. It is capable of supporting sites that require millions of daily queries. Many renowned national and international companies trust him for the development of their Internet site. These include TF1, IBM, Le Monde, Le Figaro, Club-Internet, Orange, Yellow Pages… A recent report dated November 2006 indicates that 87% of CAC40 companies use PHP. Read the interview with Perrick Penet (AFUP).

PHP, a language designed for dynamic web applications
The PHP language has the primary function of being specially designed for the realization of dynamic web applications. By definition, a “dynamic application (or page)” is a program capable of generating a single page based on parameters transmitted to it.

PHP for other application areas

PHP is not necessarily limited to editing dynamic web pages. It can, for example, be used in command line via the PHP executable. This use case then allows scripts to be executed directly on the machines. A PHP script would then be used for the machine. We can very well imagine a PHP program capable of deleting a certain number of files in a folder. It is even possible to couple the use of PHP with a task manager such as a cron server under Linux.

PHP is also the possibility to create heavy applications running without a server or browser. In other words, traditional, stand-alone applications with windows. All this is done using the PHP GTK library available at

Another strength of PHP is its ability to interface very quickly with many relational database management systems (RDBMS). Among them, we can find MySQL, Oracle, SQLite, MSSQL, PostgreSQL… Thanks to these systems coupled with the PHP language, it becomes possible to distribute applications on several servers (Web server + database server). The second interest in this is to be able to make an application even more dynamic. Indeed, the data (content) of the application is now in the database and PHP takes care of retrieving and manipulating them (processing strings, saving to files, generating RSS feeds…).

The possibilities offered by PHP are thus very numerous, and we will not detail them all because we would stay there for hours. Let us nevertheless retain a list of its primary capacities:

Manipulation of a file system (creation, editing, deletion, access rights…)
User session management
XML document generation and parsing with the SimpleXML library
Image generation with GD2
PDF file generation
Easy database access with PDO library
Shell Command Execution
POP and IMAP email management
ZIP archive compression and decompression
MD5 and SHA1 encryption
LDAP directory management
Handling of dates
URL manipulation
Sending and reading cookies
Dialog with Java
Using Ajax

The current version of PHP brings a breath of fresh air to the language and professionals. The main missing until then was his model object too succinct. The developers then addressed this issue and finally implemented a Java-like object programming model.

The limits of PHP

Despite all the qualities that we can attribute to the PHP language, some defects remain. For example, in the case of extensive applications, it may have some weaknesses and become unsuitable. A language such as PERL would then become more appropriate. However, this argument remains very subjective as PHP developers improve the quality and robustness of the language.

The second defect (but which paradoxically makes its success and its quality) that we can blame it for is its great simplicity of use. This has tarnished the image of PHP a lot because any webmaster (even very inexperienced) becomes able to create code and applications quickly. However, most code produced by amateur developers is not necessarily “clean” or well-designed, often insecure, unsustainable and even unoptimized. Other languages like C++, Net, Java, ASP, Perl, Python or Ruby, do not suffer from this lousy image as their learning is not necessarily elementary.

Finally, the last reproachable flaw in PHP is its lack of rigor in the terminology of functions and syntax.