Good, versatile and ugly. Why is PHP still alive? | KISS digital


Good, versatile and ugly. Why is PHP still alive?

PHP is not popular among the young generation of software developers. It is a programming language with a long history, which involves a number of outdated solutions. It lacks grace, consistency and is no longer state-of-the-art. However, it has a fundamental advantage: you can solve almost any problem with it.

On Quora, the most popular English-language Q&A website, questions about the imminent "death" of PHP have appeared regularly for many years. The more restrained ones concern the sense of further existence of PHP at a time when Python, JavaScript or Ruby are leading in popularity rankings. On the one hand, authors of such posts can be accused of trolling. Especially in the context of the fact that about 80% of websites are powered by PHP. On the other hand, this type of "provocation" has a certain benefit, it contributes to the discussion on the value of PHP against the background of increasing competition.

A short history of PHP

PHP was created in 1994 by Rasmus Lerdorf. The initial version of this language was a set of Perl scripts, which was used by Lerdorf to monitor traffic on his website. As the number of visitors increased, the developer rewrote the scripts in C-language, adding more features, and in 1995 he released the source code of his work. PHP quickly gained popularity and became a global project. By 1997 it was used by more than 50,000 software developers around the world.

PHP is a general-purpose scripting language. However, it is primarily designed to develop dynamic websites and web applications. According to data from August 2019, 79.1% of web sites used PHP as a programming language on the server side. It has also been used to develop a large number of web applications, such as content management systems, discussion forums and database clients. CMS systems created in PHP include WordPress, Drupal, Joomla or MediaWiki, which are the most popular "brands" in their category. PHP also powers the back-end or front-end of websites such as Facebook, Dailymotion, Digg, Slack, Flickr or Tumblr. It is worth mentioning that even the White House website is powered by WordPress (previously by Drupal). The programming language created by Lerdorf was also used to develop Magento – an engine used by more than 10% of all online stores in the world.

Well, if PHP is so popular, why are there questions about its imminent end?

PHP is ugly because it is inconsistent

Many people believe that PHP's best days are over. The programming language created by Lerdorf fell out of the developers' favor a few years ago and has become an ugly duckling in the software industry. Why? "PHP was designed very poorly from the outset and it has never been really fast. This is the main reason why it is hated by most developers” – as you can read in one of the answers under the question about the "continuity of existence" of PHP on Quora (It is worth to read it to the end because the "attack" on PHP is only a prelude to the defense of this programming language).

This complaint is, to some extent, justified. Without a doubt, we can say that PHP is an ugly language. Mainly due to inconsistent syntax. For developers who are learning how to code with it, the problems may include discrepancies in method bases or the way parameters are passed to functions, ambiguities of some operators, errors that do not cause the script to break or conflicts between functions. This is due to the fact that PHP has a very long history. It has been created by various developers taking different approaches. This has resulted in solutions that are sometimes clumsy and made the language not very consistent.

With PHP you can do anything

However, the long history of PHP has its good points, which outweigh the disadvantages of this language. The most important ones include a considerable number of mature frameworks such as Laravel, Symfony, Zend, Phalcon or Yii, and libraries with various applications, also at enterprise level. Their abundance allows us to implement quite complex projects in a short time. For example, we can create an extensive administration panel within a few days. PHP also has a very rich standard library, i.e. many built-in tools, for example, to handle PDFs, connect to different types of databases or handle graphics. Thus, it can definitely be said that PHP is a programming language with solutions for most problems. From the point of view of the developer's work efficiency, this is an advantage that cannot be overestimated.

The benefit of PHP in its current form is also speed. In its previous versions, this programming language was not considered a speed demon, however, version 7.0 in the benchmarks proved to be even 14 times faster than version 5.0 released in 2004. Moreover, in one of the tests v.7.0 performed much better than currently popular Python or Ruby. In practice, the results may be less spectacular, but the "new" PHP is still doing quite well: in real tests, the most popular frameworks perform about 70% faster compared to the previous stable version, some other data indicates a three-fold improvement in performance. Sure, there are better ones – but in their own, narrower category. For example, PHP will not outdo Go or other compiled languages that perform certain mathematical operations at lightning speed. Nevertheless, it has many advantages. PHP is a general-purpose language and its strongest point are resources that allow for efficient performance of a variety of tasks at a relatively low cost.

"Bad language" is harmful to PHP

This advantage is the result of cooperation of a large community of developers working on PHP. The problem is that the rumors of the imminent "death" of this language are not conducive to deepening this cooperation. On the one hand, they result from misconceptions about the value of this language and judging it solely through the prism of shortcomings, partially removed in the last version of PHP. On the other hand, they are the result of the growing popularity of "competition" such as Python, Ruby or JavaScript. These languages are, of course, excellent in many respects, although poorer in terms of the number of frameworks and libraries available. Furthermore, Python, which has been very popular in recent years, is regarded as relatively easy to learn, which brings it many new enthusiasts. Those who are beginning their adventure with programming have a less favorable attitude towards PHP. In the future, this may lead to a slowdown in the development of its environment.

Hopefully, this will not happen. The optimizations introduced in the version 7.0 should convince sceptics that PHP is not only worth implementing, but also learning. It is a programming language which, due to the range of applications and availability of ready- made solutions, has little competition on the market.

If you are looking for a partner who will carry out your project with care for its safety – let's talk!