PHP is first an interpreted scripting language (actually precompiled opcodes), free, open source and distributed under a license authorizing the modification and redistribution.
PHP is supported on multiple operating systems. This is for example the case of Microsoft Windows ™ versions as well as systems based on UNIX base (Apple Mac OS X ™, Linux or Sun Solaris).
It will be very easy to move an application written in PHP an original Windows server to a Linux server without having to modify (or very little).
From a performance standpoint, PHP needs a Web server to run. All pages requested by a client will be built by the web server, depending on the parameters passed, before being returned to the client. The diagram below illustrates the principle of operation of PHP.
Note: it would have been possible to add a database server (local or remote) in this illustration. Then we would have two additional steps that are querying the database for PHP and retrieving results from the SQL server.
PHP is a "high level" language whose syntax is very similar to the C language syntax. Nevertheless, the rapid control of its syntax does not mean control of its features and its concepts. A good knowledge and advanced use of PHP Programming requires a relatively long learning curve.
PHP language of wealth
One of PHP's strengths is its richness in terms of functionality. Indeed, it has at the origin of more than 3,000 native features ready-guaranteeing developers to overcome additional development time and sometimes tedious. These functions among others to treat strings, to operate mathematically on numbers, convert dates to connect to a database system, manipulate files present on the server ...
PHP also draws its richness from its vibrant developer community. It was estimated at 500 000 people in 2003, but it is very likely that it has surpassed one million now. Community developers profiles are very diverse. It there's those who bring new features and version to version libraries, those that translate the documentation in multiple languages or programmers with more modest skills that perform opensource applications ready for use. Among the best known, we can cite the CMS (Joomla, SPIP, Dotclear, Wordpress ...), online sales systems (OSCommerce) Forums (PHPBB, IPB, vBulletin) frameworks (Zend Framework, Symfony , CakePHP, Jelix) ...
PHP, a reliable and efficient language
The language has now become a reliable language, efficient and viable. It is capable of supporting sites that sollicent millions of daily requests. Many nationally and internationally renowned companies trust it for the development of their website. We can mention among them IBM, Le Monde, Le Figaro, Club-Internet, Orange, Yellow Pages ... A recent report shows that 87% of companies use PHP.
PHP, a language designed for dynamic web applications
PHP has the main function to be specially designed for producing dynamic web applications. By definition, an "application (or page) Dynamic" is a program capable of generating a single page based on parameters passed to it.
A PHP script can be integrated directly into a html code. Small practical example below:
First PHP program: "Hello World"
<title> Hello World PHP </title>
<?php echo 'Hello World!'; ?>
The PHP script, clearly identified by two <?php (opening) and ?> (Closing) will cause the writing of the Hello World string between html tags after his execution on the server.
We would also have achieved the same result by using the php script:
Another version of the "Hello World"
<title> Hello World PHP </title>
<?php echo '<p> Hello World </ p>!'; ?>
Therefore, we deduce that PHP is able to generate HTML (and other formats), which makes all its interest. The presentation of the generated document is then completely dependent on past conditions and initial parameters provided. Take the example of Amazon.com mail order site. Registered users of the site have already placed several orders will be surprised to see each new visit on their personalized page, a list of automatically selected products that meet the criteria of its previous purchases. Each of these actions targeted direct marketing is unique and generated by the interests of the consumer.
PHP for other application areas
With his wealth, PHP is not necessarily limited to the editing of dynamic web pages. It can for example be used from the command line through the use of the executable php. This use case then allows to execute scripts directly on the machines. A PHP script would then be in favor of the machine. We can very well imagine a PHP program that can remove a number of files in a folder. It is even possible to couple the use of PHP with a manager like cron tasks a Linux server.
PHP is also the ability to create heavy applications operating without server or browser. That traditional applications, autonomous and with windows. All this is done using the PHP GTK available at: http://gtk.php.net
Another highlight of PHP is its ability to interface easily with many relational database management systems (RDBMS). Among them we can find MySQL, Oracle, SQLite, MSSQL, PostgreSQL ... With these systems coupled to the PHP language, it becomes possible to distribute applications across multiple servers (Web server + database server). The second interest is to make it an even more dynamic application. Indeed, the data (content) of the application is now in the database and PHP will retrieve and manipulate them (processing strings, check in files, generation of RSS feeds .. .).
The possibilities are many PHP and we will not detail them all because we would stay there for hours. Nevertheless retain a list of its key capabilities:
• Handling a file system (create, edit, delete, access rights ...)
• Managing user sessions
• Generation and parsing XML documents through the SimpleXML library
• Generating images with GD2
• PDF generation
• Simplified access to databases with the PDO library
• Shell Command Execution
• E-mail management in POP and IMAP
• Compression and decompression of ZIP archives
• MD5 and SHA1 encryption
• LDAP Directory Management
• Manipulating dates
• URL manipulation
• Sending and reading cookies
• Dialogue with Java
• Using Ajax
The current version of PHP brings a great breath of fresh air to the language and professional. The main lack was far too succinct its object model. Developers are then addressed this issue and finally implemented a programming model object close to the Java language. With such a model, still hesitant to use PHP professionals are becoming more numerous. Applications completely object also emerging and include a design pattern (design pattern) MVC. Best known today are the frameworks Zend and Symfony respective companies and Zend Technologies Sensio (French agency).
Despite all the qualities that we attribute to the PHP language, some flaws still exist. For example, in the case of very large applications, it may have some weaknesses and become unsuitable. A language such as PERL would become more appropriate. This argument, however, is very subjective since PHP developers improve the quality and robustness of language.
The second fault (but paradoxically its success and quality) we can blame him is its ease of use. This greatly tarnished the image of PHP becaufe any webmaster (even very inexperienced) becomes able to create code and applications easily. However, most of the codes produced by amateur developers may not be "clean" or designed, often insecure, somewhat maintainable and even unoptimized. Other languages like C ++, .Net, Java, ASP, Perl, Python or Ruby does not undergo this bad image to the extent that their learning is not necessarily very easy.
The last reproachable default PHP is its lack of rigor in the nomenclature of functions and syntax (see tutorial on using short tags). First, the functions are not case sensitive, which means for example that str_replace () and str_replace () are identical to the PHP interpreter. Fortunately the new version in progress (PHP6) will solve this defect. Furthermore, we see a lack of standardization of function names:
• Using underscore separator: str_replace (), preg_match (), mysql_real_escape_string () ...
• Functions composed of several words written in one: wordwrap (), htmlspecialchars () ...
• Translation of to literal or in cash: bin2hex () strtotime () ...