Skip to content

  • How to start learning programming
    • What is a programming language
    • Swift
    • JavaScript
    • CSS
    • HTML
  • What does a web developer do
    • What does it mean to be a programmer
  • Interface is a set of tools
    • Framework
    • Git
    • SQL
  • Hypertext PreProcessor
    • Who is deep learning engineer and Android Developer
    • Website layout

Hypertext PreProcessor, “hypertext preprocessor”

Hypertext PreProcessor, “hypertext preprocessor”

PHP (Hypertext PreProcessor, “hypertext preprocessor”) is a scripting programming language. Has an open source code. It was originally created for developing web applications, but in the process of updates it became a general-purpose language.

Where PHP is used

The PHP programming language was designed by Danish programmer Rasmus Lerdorf in 1995 as a tool for creating interactive and dynamic websites. Now PHP is actively used by web developers to create websites and web applications. It is the least competitive language to work with. It is used by most services, and, most likely, the situation will not change in the next 10 years. Therefore, specialists are in great demand.

The main area of ​​application is the development of scripts that work on the server side. You can also create command-line scripts and GUI applications (applications with a graphical user interface).

PHP is used in projects of various sizes: from a browser game and a social network to large web applications on the Internet, such as Facebook, VKontakte, Google, W3C, Yahoo, NASA. Many content management systems (CMS) are written in PHP, such as Drupal, WordPress, Joomla. It was also used in the development of popular frameworks for creating websites, such as Yii2, Laravel, Symfony.

PHP Properties

PHP is a dynamically typed language. This means that the variable is not defined rigidly and in advance (if a number, then int, if a string – string). Dynamic typing allows you to assign multiple values ​​to the same variable: it can be an array, string, number, object, etc. Dynamic typing is convenient and flexible, but it consumes a large amount of RAM and reduces performance.

PHP is also an interpreted language. This means that the code written in PHP is not compiled (converted to machine language), but is executed line by line with the help of an interpreter program that reads each of them and executes what is indicated there.

How PHP is different from other programming languages

CSS and HTML files, as well as image files, the server sends immediately to the client (browser), regardless of the content. In contrast, PHP files contain code that is interpreted by the server. The client (browser) does not receive the PHP code itself, but the result of its execution, which, as a rule, is pure CSS and HTML. The user cannot see the source code of the program. This is good from a security point of view, since in this case it is difficult to understand the logic of the site.

PHP stores the state created at the current moment in time. Unlike classical compiled programming languages, which run all the time from start to stop of the program, a PHP script starts executing from the moment the web server is called and ends (forgets everything it knew) when it returns the generated data packet back to the web server.

1. An incoming connection is received and parsed by the web server. Interpretation takes place and a response is formed.

2. As a rule, the result of the PHP interpreter (the program that executes PHP code) is HTML code. This step converts the PHP script into static HTML that the browser can read. PHP can use MySQL, a free database management system (DB), to run. It communicates with the database server in a consistent language (SQL). The database server and the web server form a tandem that reads and writes information and data and provides them to site visitors.

3. The database sends the data to a PHP script, which puts them in the right places on the page or data package and generates the final response. The response is sent back to the web server, which returns the page or data packet to the client.

The ability to combine PHP and HTML code allows you to create dynamic pages that show different information each time depending on the data received from the user or settings.

PHP versions and their differences

PHP 3.0. The first version, reminiscent of a modern interpreter, was released in 1997. The main advantage is the ability to extend the core and add additional modules by third-party developers. Version 3.0 introduced support for OOP syntax. The syntax of the language itself has also been strengthened.

PHP 4.0. It appeared in 2000 and received an updated Zend Engine (the name was formed from the names of its creators – the owners of Zend Technologies). Significantly improved performance. The version began to support more servers and HTTP sessions. Handling user input has become more secure. Several new language constructs have been created.

PHP 5.0. Came out in 2004. The appearance was preceded by a series of prereleases and a long development. The language is driven by the updated Zend Engine 2.0 with a fundamentally new object model and other additions.

PHP 7.0. Came out in 2015. Increased performance: it became possible to handle more traffic with the same resources of the web server. In the new version, it became possible to specify the type of data returned from the function, control of passed types for data and new operators were added.

PHP 8.0. This is the latest variant that was released at the end of 2020. The language received support for union types (data structures or values ​​that can have several different representations), annotations (attributes), as well as compilation of bytecode into machine code at runtime (JIT compilation). Microsoft decided not to support version 8.0 for Windows, so this work is now being done by community members interested in running PHP on the operating system.

2022 © Copyright. All rights reserved.