PHP
PHP is a general-purpose programming language that is especially suited to web development.
It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994.
Currently, the implementation of PHP is produced by The PHP Group.
PHP originally stood for Personal Home Page, but now it stands for Hypertext Preprocessor.
PHP code is typically processed on a web server by a PHP interpreter implemented as a module, a daemon, or as a common input interface (CGI) executable. On a web server, the result of interpreted and executed PHP code - which can be any data type, such as generated HTML or binary image data - would form all or part of an HTTP response.
There are various template systems, content management systems and frameworks that can be used to organize or facilitate the generation of that response.
On the other hand, PHP can be used for many programming tasks outside of the web context, such as stand-alone graphical applications and drone control. Any PHP code can also be interpreted and executed through a line interface of commands (CLI).
The standard PHP interpreter, powered by Motor Zend, is free software released under the PHP License.
PHP has been widely ported and can be deployed on most web servers on almost all operating systems and platforms, for free.
The PHP language evolved without a formal written specification or standard until 2014, with the original implementation acting as the de facto standard that other implementations tried to follow. Since 2014, work has been done to create a formal PHP specification.
Characteristics
- Oriented to the development of dynamic web applications with access to information stored in a database.
- It is considered an easy language to learn, since in its development different specifications were simplified, as is the case of the definition of primitive variables, an example that becomes evident in the use of php arrays.
- The source code written in PHP is invisible to the web browser and the client, since it is the server that is responsible for executing the code and sending its HTML result to the browser.
- Ability to connect with most of the database engines that are used today, its connectivity with MySQL and PostgreSQL stands out.
- Ability to expand your potential using modules (called extensions).
- It has extensive documentation on its official website, among which it stands out that all the system functions are explained and exemplified in a single help file.
- It is free, so it is presented as an easily accessible alternative for everyone.
- It allows applying object oriented programming techniques.
- It does not require definition of variable types although its variables can also be evaluated by the type they are handling at runtime.
- It has exception handling (since PHP5).
- Although PHP does not force its users to follow a certain methodology when programming, even when doing so, the programmer can apply any programming or development technique to his work that allows him to write orderly, structured and manageable code. An example of this are the developments that have been made in PHP of the Model View Controller (MVC) design pattern, which allow separating the treatment and access to data, the control logic and the user interface into three independent components.
- Due to its flexibility, it has been widely accepted as the base language for content management WEB applications, and it is its main use.
Drawbacks
- Because it is an interpreted language, a PHP script usually works considerably slower than its equivalent in a low-level language, however this inconvenience can be minimized with both file and memory caching techniques.
- In versions prior to 7, the variables are not typed, which makes it difficult for the different IDEs to offer assistance for typing the code, although this is not really a drawback of the language itself. This is solved by some IDEs by adding a comment with the type to the declaration of the variable.