PHP is the most “tenacious” programming language. They predict a quick death for him for a year, but its still one of the most popular. In 2021, PHP ranked 10th in the TIOBE index , ahead of Swift, Ruby and Objective-C.
And since it’s too early to write off PHP, let’s figure it out – where it is used, why PHP is needed and what it is all about.
PHP language features
These features determine how PHP performs tasks, communicates with sites and applications, and who can change it (spoiler alert – everything).
PHP is a scripting (scripting) language. In such languages, scripts or scripts are written – programs that automate small routine tasks. Otherwise, they would simply have to be done manually.
PHP is an interpreted language. Since PHP is an interpreter, this has many advantages:
- there is no need to free the allocated memory or close files when you finish working with them – the interpreter will do all the routine work;
- debugging programs and detecting errors are simplified – the interpreter has full control over this process;
- the server does not “hang” when the application is not working properly.
PHP is a server-side language. All work takes place on a remote web server. You open the site – a request is sent to the server, performs the specified actions, returns the result and ends.
This means that the language may not be installed on the device at all. A computer, laptop, smartphone may not understand PHP and be completely unfamiliar with it. At the same time, the site or application starts up and works stably.
The browser does not matter either – the PHP program works successfully from anyone.
PHP is a dynamically typed language. This means that the types of variables are determined at runtime, different types can be used together, and implicit conversions are done automatically.
PHP is an open source language. Anyone can supplement and improve the PHP language, fix vulnerabilities and bugs, add new functions and use it in their own development.
Why PHP was invented
PHP was invented in 1994 by Danish programmer Rasmus Lerdorf. Back then, it was not yet a full-fledged programming language, but just a set of scripts that allowed Lerdorf to make the first online resume in the form of an HTML page.
PHP stands for Personal Home Page – and refers to what the language was originally – a tool for developing personal web pages
At that time, it was only possible to create sites without studying programming volumes.
Now PHP is supported by Zend Technologies: in 1997 it released the third version of the language and is actively developing it ever since.
As a result, the project has grown to such an extent that it received its own syntax, many new features and recognition among developers.
Evolution of PHP versions
PHP has come a long way before becoming one of the most popular programming languages. Let’s see how it changed from the first version to the last.
PHP 1.0-2.0 – 1994. Early versions were raw. The first and second modifications had the basic functionality of today’s PHP. It included variables in the style of Perl, the language for working with text that formed the basis of PHP, automatic form interpretation when the language automatically creates variables upon the arrival of a form, and the ability to be embedded in HTML code.
The syntax had a lot in common with Perl, although it was much simpler.
The second version of PHP, called PHP / FI 2.0, was used by 50 thousand domains – about 1% of all domains on the Internet
PHP 3.0 – 1997. The third version, in comparison with the previous ones, has stepped far forward, and defined the face of PHP, making the language the way we know it.
Israeli programmers Zeev Sourasky and Andy Gutmans, who then joined the project, decided to rewrite the code again because PHP / FI 2.0 was very limited.
One of the strengths of PHP 3.0 is its core extensibility, which has attracted many third-party developers to the language who want to add their own modules to PHP. This was the key to success.
By the end of 1998, the number of PHP users was in the tens of thousands. The third version has already taken over 10% of the Internet’s web servers, including those running Windows 95, 98, NT and Macintosh. It has already been installed on seven thousand domains
PHP 4.0 – 1998. Redesigning the core is the main task that the developers set themselves after the release of PHP 3.0. The efficiency of applications written in PHP was far from ideal – something had to be done about it. The new Zend Engine solved the problem and significantly improved PHP performance.
PHP 5.0 – 2004. The fifth version received an updated core – Zend Engine 2 and redesigned object-oriented programming functions, which became in many ways similar to the model used in Java. And the code speed increased by 10-20%.
PHP 6.0 – 2006. The sixth version was skipped. They wanted to build into it support for Unicode, a coding standard that includes the characters of almost all written languages in the world. But the release never took place. That’s why:
“PHP 6 was ambitious, but it sucked. That’s why we tackled PHP 7, skipping version 6 in the process. “
Vilson Duka , one of the developers
PHP 7.0 – 2015. The fastest version of the language that works without static typing – it is only available in function parameters. Added new operators, the ability to specify the type of data returned from the function and control of the transmitted types for data.
PHP 8.0 – has been officially released to the General Availability on November 26, 2020!
It’s currently the latest PHP version. It’s a new major version, which means that there are some breaking changes, as well as lots of new features and performance improvements.It contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and improvements in the type system, error handling, and consistency.The most acclaimed feature coming with PHP 8 is the Just-in-time (JIT) compiler. What is JIT all about?
Why PHP is good
These are the main advantages of PHP, thanks to which it has an army of fans around the world and still lives and thrives.
Simple syntax. PHP is similar in structure to C. Some elements have migrated from Perl. And to write the simplest script, you don’t need variables and modules – PHP statements are enough.
Rich ecosystem. PHP supports many libraries, frameworks and databases.
YII, Laravel, Symfony, CodeIgniter, Phalcon, Slim, ZendFramework, CakePHP, Aura, Fat-free – this is not a complete list of frameworks that PHP works with
PHP supports all known databases – MySQL, PostgreSQL, SQLite, MS SQL, Oracle, dBase, etc.
Ease of learning. There is no need to install special compilers – the simplest hosting, even free, and a notebook will be enough. Even beginners will be able to master the language in one to two weeks.
What PHP is for
Web development is PHP’s only purpose. You cannot write applications on it, the language is not used in mobile development – only the web. But this area is huge.
Here’s what you can do in PHP:
- Separate modules. PHP code can be embedded in HTML pages, or saved as a separate file. In this case, we get mini-modules, each of which is responsible for one thing.
These modules can be a site header, footer, menu, or a block with product reviews.
- CMS and site engines. PHP’s modular capabilities have contributed to the fact that most modern content management systems on sites are written in PHP.
WordPress, Drupal, Joomla, MediaWiki, OpenCart, phpMyAdmin are written in PHP
- Data collection form and authorization system. It is enough to tell the language what to take, from which field and to which address to send, and the interpreter will do the rest on its own.
Facebook – entire server side of the social network is made in PHP
- Dynamic pages. PHP script that shows different content depending on the URL.
- Sessions and Cookies. They are needed to store user data when navigating between pages. And this is also a PHP mechanism that can be implemented through the session_start () functions.
The future of PHP
“There are dying languages like COBOL and FORTRAN. There are traditional languages in which Microsoft, for example, works – C # and JavaScript. There are modern languages, the peak of which is still pending – Kotlin, Crystal, Rust and Swift.
PHP is difficult to relate to any particular kind. It certainly does not die, it cannot be called young, but because of the constant improvement of his capabilities and functionality only grow, which is why it will be popular over the next ten years. It is difficult to predict what will happen to him in another ten years. Even if it suddenly loses popularity for some reason, by that time billions of lines of code will be written on it, requiring maintenance. “
The labor market in 2021 has changed globally. If earlier the main criterion for having a job was an office, now, due to the global pandemic, even world-famous companies have begun to use remote work. This opens up tremendous potential for aspiring PHP developers.
Is it worth learning PHP in 2021
Definitely worth it. PHP is a popular, easy-to-learn backend language that offers a lot of possibilities.
Whether web developers will massively switch to other technologies is an open question. Now, if you buy shared hosting, you immediately turn on the PHP interpreter, because everyone uses it. Other technologies like Python or Node.js do not, they need to be installed separately.
But the web is not forever. Another 20 years, and the concept of a website may become outdated, because people will be sitting in applications and social networks.
So you can safely learn PHP and be sure that the acquired skills will come in handy. Especially if you want to work with “WordPress”, “Drupal”, “Jumla” and other well-known site management systems. They are written in PHP, and so are all add-ons and add-ons.
Briefly about PHP
To get everything in your head, keep the cheat sheet:
- What is PHP – an open source server-side scripting language.
- Why PHP was created – to create simple personal pages, and then full-fledged sites.
- PHP versions – first and second had basic PHP functionality. The third defined the appearance of the language, it also added the possibility of extending the core, which brought PHP success. The fifth became famous due to the updated kernel and object-oriented model, the sixth did not come out, and the seventh is the fastest of the previous ones.
- The advantages of PHP are interpretability, simple syntax, extensive ecosystem, low entry threshold.
- Disadvantages of PHP – dirty code, slow speed, security problems, system instability.
- What is written in PHP – dynamic pages, sessions and cookies, CMS and site engines, authorization and feedback forms, mini-modules, captcha, file managers and text editors.