Many beginners and even experienced developers, but who don't know the language, question what are the reasons to choose, and definitely use PHP as the programming language for a small or large project, first language or freelance project.
Many love to hate the PHP language, even so, an expressive number of developers use it.
From Reddit threads to popular Twitter posts, haters and lovers will be present discussing fervently about PHP.
But instead of simply pointing out issues for hating or loving, to give opinions or suggestions, I will describe in this article reasons to choose the PHP language in the year of
It's important to start by saying that it is much more than just a web server scripting language. With it, it is possible to build APIs, background processes, systems with complex management of execution in queues (Queues) and CLI applications.
First, it is better to understand the historical context of the PHP language to understand most of the criticisms of it.
Why criticisms often hate for PHP?
Many developers like to criticize other languages, often without being able to properly explain why. Here are some historical contexts to explain this common sense among many:
It's true that most people who hate PHP do so based on what their developer friends say and their first Google search using terms like "why PHP is bad".
But this is not the main base. People have been following “celebrities” in the field, trends, and what was considered hype for a few years, going back to the time of PHP version 3.
However, the language has grown and evolved a lot, with each major version released, with great leaps in quality and functionality. Even so, the volume of material that cites the defects of the old versions is still constantly researched and read by people who do not take these developments into account.
There is still the misperception of developers who criticize openly, without delving into the study of the language and its ecosystem, bringing criticism for lack of practical knowledge.
There is still a group of developers who are frustrated with the language, because they are stuck, coding in it but performing maintenance on legacy applications, thus not having the opportunity to know the evolutions of the PHP language.
PHP and Its Dark Past
The PHP language has come a long way since its inception in 1994.
It was originally intended to be a templating engine on top of C lang, just like Twig, Blade or Jinja for Python forks, or EJS in the nodeJs world.
Who were the first users?
Beginner developers, who found it very easy to use and wanted to do everything expected of a language in it. So the language has grown far beyond the maintainer's initial goal. The creator Rasmus Lerdorf.
At the time, the features that were introduced in the language suffered from quality, due to the lack of an adequate design.
An example is the Libapache extension which allowed Apache web servers to run PHP scripts, something never before done at this time, as well as the now deprecated MySQL – mysqli extension which simplified the creation of dynamic web pages, accessing data in databases, when the default for the time was static pages.
The pressure from users to make the language do more, and the lack of an adequate vision of its future, has brought many inconsistencies, unpredictability and a few inconsistencies here and there.
Even with all these uncertainties, it is necessary to acknowledge and take off our hats to Rasmus Lerdorf and the early development team for their contribution to PHP, otherwise we would not be having this “conversation” today.
They say it is necessity that brings innovation, not the other way around. And PHP remains true to this precept.
3. Syntax choices
Php was born with some “problems” with the syntax, at least initial naming inconsistencies, to be honest, some things still bother me – you can't be perfect.
However, it is necessary to understand that many are choices that, again, do not invalidate, but were always targets of criticism.
But haters fire and focus on this feature (which is often this and not a defect) to invalidate the use of the PHP language.
Here are some examples:
a) nl2br() – has a number in its name, but other built-in functions do not.
b) Underscores – underscore, snake case … vs no underscore, eg fopen(), str_replace(), strtolower(), str_shuffle(), this lack of standardization is sometimes annoying.
c) Unnecessary functions – for case-sensitive vs case-insensitive string functions, for example str_replace() vs str_ireplace(). Some languages prefer the developer to use multiple functions, like strtolower() and then str_replace, for example.
d) The use of the $ character (dollar sign) to identify variables – this feature bothered me at first, today I miss it at times in other languages.
e) The use of french quotes ( -> ) – dash of greater sign, instead of period (.) to pass the access message in methods and properties – this characteristic has always bothered me.
I could go on, but these are just a few examples of problems or unique features, constantly criticized, in the PHP language syntax, it would still have the ordering of the parameters, but I'll stop here 🙂 .
We developers really hate legacy. So, with PHP being one of the most popular and oldest web programming languages in production, there's no escaping this ghost.
Many developers ended up being dragged into the nightmare of keeping legacy systems on old versions of PHP, and because of these circumstances, they now hate it.
Those who have switched to other languages and technologies are still stuck in the thought that PHP is still in the PHP 3 or 4 days.
Reasons to use PHP
Let's now list several reasons why to use the PHP programming language in
I will not go into the facts that approximately 80% of the internet runs on PHP, most sites are on WordPress, or that large companies such as Facebook, Slack, Wikipedia, PicPay use it as one of the main languages in their stacks.
PHP is fast
Compared to other interpreted languages like Ruby or Python, PHP is very fast.
This is largely due to its architecture, and its close ties to the C language.
Also, the core PHP team has been working so that since PHP version 7, it gains in performance by rewriting the underlying code to improve performance, and they have succeeded.
This version alone more than doubled the performance compared to previous versions.
article under construction
Want to read the rest of the article, follow me on Twitter @nunomazer to receive the information when it is released.