Standing for PHP: Hypertext Preprocessor according to ABBREVIATIONFINDER, PHP is an interpreted programming language originally designed for creating dynamic web pages. It is used mainly in server-side scripting but currently can be used from a command line interface or in the creation of other types of programs including graphical interface applications using the Qt or GTK + libraries.
PHP can be combined with MySQL to work with databases. At present the latter is widely used today. This example shows a simple user login and password using MySQL and PHP
<? php // Avoid errors of type warning error_reporting (E_ERROR | E_PARSE | E_WARNING ); // Define variables by post method $ user = $ _POST [ ‘user’ ]; $ password = sha1 ($ _POST [ ‘password’ ]); // Check that the user variable has a value and if the enter button was pressed if ( ! Empty ($ user) &&! Empty ($ password) && isset ($ _POST [ ‘enter’ ])) { // Connect with user mysql_connect (‘localhost’, ‘root’, ”); // Select the database mysql_select_db (‘login’); // Query to select the users $ query_user = mysql_query (“SELECT * FROM users WHERE user = ‘ $ user‘” ); // Number of user found $ found_users = mysql_num_rows ($ query_user); // Verify that the variable found_users is not 0 if ( $ found_users ! = 0) { // Check if the password is correct $ query_password = mysql_query (“SELECT * FROM users WHERE password = ‘ $ password ‘”); // Number of passwords found $ found_password = mysql_num_rows ($ query_password); // Check if the number of passwords found is not 0 if ($ found_password ! = 0) { // Success text echo “You have started section successfully”; } else { // Error text echo “The password is not correct”; } } else { // Error text echo “User does not exist”; } // Close the connection mysql_close (); } ?>
History
Version | Date | Most important changes | |
PHP 1.0 | June 8, 1995 | Officially called “Personal Work Tools (PHP Tools)”. It is the first use of the name “PHP”. | |
PHP Version 2 (PHP / FI) | April 16, 1996 | Considered by the creator as the “fastest and simplest tool” for creating dynamic web pages. | |
PHP 3.0 | June 6, 1998 | Development moved from one person to many developers. Zeev Suraski and Andi Gutmans rewrite the base for this version. | |
PHP 4.0 | May 22, 2000 | A more advanced two-stage scan / run tag analysis system called the Zend engine is added. | |
PHP 4.1 | December 10, 2001 | Introduced the superglobals variables ($ _GET, $ _SESSION, etc.). | |
PHP 4.2 | April 22, 2002 | Register_globals are disabled by default. | |
PHP 4.3 | December 27, 2002 | Introduced the CLI, in addition to the CGI. | |
PHP 4.4 | July 11, 2005 | ||
PHP 5.0 | July 13, 2004 | Zend II engine with a new object model. | |
PHP 5.1 | November 25, 2005 | ||
PHP 5.2 | November 2, 2006 | Default extension filter enabled. | |
PHP 5.2.4 | August 30, 2007 | ||
PHP 5.2.5 | November 8, 2007 | Version focused on improving stability (+60 bugs fixed). | |
PHP 5.2.8 | December 8, 2008 | ||
PHP 5.2.9 | February 26, 2009 | Various improvements in the field of security (+50 bugs fixed). | |
PHP 5.2.12 | December 17, 2009 | Various improvements in the field of security (+50 bugs fixed). | |
PHP 5.3 | June 30, 2009 | namespaces, late static binding, closures, optional garbage collection for cyclic references, new extensions (+140 bugs fixed). | |
PHP 5.3.1 | November 19, 2009 | Various improvements in the field of security (36 bugs fixed). | |
PHP 5.3.2 | March 4, 2010 | Various improvements in the field of security (99 bugs fixed). | |
PHP 6 | S / D | ||
PHP 7 | S / D |
}
Applications developed with PHP
- Social networks
- Tuenti
- E-Commerce
- Magento
- OsCommerce
- PrestaShop
- Blogs
- WordPress
- Burning Board
- CMSformE
- Dokuwiki
- Drupal
- Joomla
- Gallery Project
- Mambo Open Source
- MediaWiki (developed for Wikipedia)
- Moodle
- Phorum
- PhpMyAdmin
- PHP-Nuke
- PhpPgAdmin
- PhpWiki
- PmWiki
- Zikula (formerly called PostNuke)
- Smarty
- SPIP
- SugarCRM
- VBulletin
- Xaraya
- Xoops
- MODx
- SMF
- PhpBB
- UVG SCADA
(Many more can be found in the following list of CMS.)
- PhpCollab
Frameworks in PHP
- Zend Framework (Official, from the PHP developers)
- Kohana
- Symfony
- CakePHP
- PHP Prado
- CodeIgniter
- Yii Framework
- Lithium
- Sapphire
- Akelos
- Laravel
(Other Frameworks in PHP and in other languages here.)
Integrated development environments for PHP
Some of the most popular or common Integrated Development Environments (IDE) for PHP are:
- PDT, Eclipse plugin: GPL – (Sun).
- NetBeans, free, cross-platform.
- Zend Studio: Commercial – (Zend).
- Aptana Studio: GPL, there is a commercial version. The plugin for PHP must be installed. It is based on Eclipse, but has features that make it more desirable than Eclipse PDT; among them: code auto-completion, auto-indenter.
- Komodo IDE: Komodo Edit, free and free, the IDE is commercial license – (Mozilla).
- NuSphere PhpED: Commercial, for linux and windows.
- Quanta: GPL and free, for GNU / linux with QT.
- Bluefish: GPL and free, for GNU / linux with GTK.
- GEdit: Default text editor in Gnome – (Linux).
- Geany: GPL, for linux. Extremely lightweight. Includes autocomplete, autodenter, support for numerous languages.
- PhpDesigner: Commercial and Freeware, for linux and windows. Includes manual integration, code autocompletion, and comes in multiple languages.
- Rapid PHP: Commercial, for windows.
- AJAX PHP IDE: Development environment for PHP that uses AJAX functionality in the events of the designed forms. Separation of logic and html.
- PHP Storm: Development environment for PHP developed by JetBrains. It is characterized by offering a wide range of possibilities but at the same time it is quite demanding in terms of computer resources, something that is not new with the products of this developer.
- Dreamweaver: IDE mainly used for web development, it has a well-developed PHP interpreter, as well as the possibility of using a design view and connection interface to databases.
PHP code example
The following example shows the typical Hello World, which is a simple screen print of the same message:
<? php $ a = ‘hello world’; echo $ a; ?>
The above example would simply write “Hello World” (without quotes) on the web page. It is important to remember that every block of PHP code must be within <? Php (to open) and?> (To close) or simply in a shorter form <? <PHP_CODE>?> -As long as the short_open_tag directive is enabled, much like the tags in ASP <% <ASP_CODE>%>. Now, the result that we would have in the browser would be the following:
Hello World
Here is an example of sending and receiving data on the same page with PHP:
<html> <head> <title> Example of simple use in sending and receiving parameters with PHP </title> </head> <body> <? php // If the variable $ _POST [‘sample’] exists, then show favorite food if ( isset ($ _POST [ ‘sample’ ])) { echo ‘Hello,’. $ _POST [ ‘name’ ]. ‘, your favorite food is:’. $ _POST [ ‘food’ ]. ” ; } else { // If not, <form method = “POST” action = ” <? php echo $ _SERVER [ ‘PHP_SELF’ ]; ?> “> What’s your name? <input type = “text” name = “name” /> What is your favorite food? <select name = “food”> <option value = “Spaghetti”> Spaghetti </option> <option value = “Roast”> Roast </option> <option value = “Pizza”> Pizza </option> </ select > <input type = “submit” name = “shows” value = “Follow” /> </form> < </body> </html
In this code it is possible to observe the following characteristics:
- The variables sent by a form using the POST method are received in the language inside the matrix $_POST, which facilitates obtaining this type of data. This same method is used by the language for all sources of information in a web application, such as Cookies in the matrix $_COOKIES, URL variables in $_GET(which in forms can be used to save the data), session variables using $_SESSION, and variables of the server and client through the matrix $_SERVER.
- The PHP code is embedded within the HTML and interacts with it, allowing you to design the Web page in a common HTML editor and add the dynamic code within the tags <?php ?>.
- The result shows and hides certain portions of the HTML code conditionally.
- It is possible to use functions of the language for Web applications such as htmlentitites(), which converts characters that have some special meaning in the HTML code or that could be erroneously displayed in the browser as accents or umlauts, into their equivalents in HTML format.
All variables in PHP have the dollar symbol as a prefix (example: $ variable1, $ variable2, $ variable3…, $ variableN), variable types do not need to be declared, as they are used in the application the server recognizes what type they are. To display a string (in English string) it must be within double or single quotes (example: “Hello World”, ‘What I want to show’). It should be noted that if you want to show the “o ‘symbol, it must be enclosed in the other type of quotation marks ( “…’…”, ‘…”…’) or an escape (\’, \”) must be used.
Every line of instruction always ends in a semicolon (;), just like the C Programming Language.
To insert a single-line comment, you must start with //or #. The rest of the line is then treated as a comment. To insert a comment block, of one or more lines, use the combination /*and */, for example:
Other example:
<? php $ variablename = $ _REQUEST [ ‘data’ ]; if ( ! empty ($ variablename)) { echo “The variable has value”; } else { echo “The variable has no value”; } ?>