Previous lesson

Why Even Ask That In The First Place?

Next lesson

Why even ask that in the first place? Well, with new languages and frameworks emerging every day, it's natural to wonder if PHP is still relevant. However, PHP remains one of the most widely used server-side scripting languages and powers millions of websites worldwide. Its popularity is a testament to its flexibility, scalability, and ease of use.

PHP is known for its ability to work well with a wide range of databases, including MySQL, PostgreSQL, and Oracle. It also has excellent support for web development frameworks such as Laravel, CodeIgniter, and Symfony. With such a strong community and abundant resources available, PHP continues to be a practical choice for web development.

Almost 65% of the web servers have PHP installed and being used by billions of websites. PHP has actually become a defacto language support for any respectable web server out there.

The funny fact about that idea is this, new phenomena in any generation tends to come with a buzz. Reciprocally, as time goes, old tools become just part of everything hence, there is no need to talk about it as "a special" thing. That's the phase PHP is going through. It's not death. "We" call it the "wisdom phase". In addition, you would notice that the PHP community would have more matured people who do not fency buzz anymore since they already did that since the 90s in PHP's beginning.

The biased fact is that most people will tell you that PHP is not secured... well, there is no such thing as a "secured language". But the tools a language offers to tackle certain situations and how we use them is what creates security or not. Besides, the environment is one of the main factors of security in any software architecture, The truth is that early versions of PHP such as the 3 and 4 failed in most part to give adequate tooling. But since version 7, PHP is just another great beast to use for almost everything. And version 8 brought much more power to the language making it a whole new general-purpose programming language.

Now, more scientific facts. On many occasions, you will hear people compare PHP with other languages such as Javascript, Python, Ruby, etc. It's practically undoable and not necessary. Every single programming language is created to serve a purpose. The main question you should always ask is to know if a given language can still serve its purpose. Can it still be used for what it was intended to do? Let's put the convenience aside for now because that's a common challenge to all languages.

Talking of purpose, PHP's purpose was to secure your code or parts of it in a remote server. That involved that PHP does all possible calculations in the server before we can access our request's result. That is a noble cause if you would admit. Compared to its mainly-compared-language ‐ Javascript, its initial purpose was to do the opposite, handle calculations at the client-side.

It's only recently we got to be able to run Javascript on the server-side with the help of course, of NodeJS. That gave a little advantage to Javascript on PHP mainly because people could use the same language at both sides, client and server. But even with that, the world is already full of PHP developers who have learned and in most cases, mastered the language and how to architect most sophisticated applications. They maintained their habits of writing the logic with PHP in the backend and use Javascript for most frontend stuff. And interesting enough, if you've worked with the pair Javascript-NodeJS and the pair Javascript-PHP, you would admit that the later has more advantages both in setup and learning curve or even in maintenance.

Now you may wonder, why don't we have PHP on the client-side as well? Well, it's doable, but it's quite too late now. Because that involves shipping the engine in all browsers. And in this era, browsers have come a very long way already and we wouldn't be able to return to old versions to integrate PHP's client-side engine.

Apart from that, it would be like betraying the main goal of PHP which is to secure code, or simply avoid that the end-user gets no access to some logic of your code. Today, PHP is capable of doing anything, because it's a mature language.

In a nutshell, Javascript, nor any other language cancels PHP's purpose or goals. And the same truth is reciprocal.

What is done nowadays is that developers use Javascript for most frontend jobs and logic that's related to interfaces and interactivities, then PHP for any backend business like APIs.

You can validly create an entire website with only PHP or Javascript and get perfectly a great performance with both options. Do not hesitate to learn PHP today because it doesn't sound buzzy for some people. It's gone beyond that era. It's an adult language that lives a responsible life. Every single limitation that was reproached to PHP has been addressed in recent years including code styling, design patterns, servers and deployment, caching, security, scaling, etc. And from version 7, the speed of the engine is so great that nobody dares to criticize it or use it as an alibi to not use PHP. That's why I teach you PHP from version 7 in this book, hence the name php7up.

One of the best way of maintaining friendship between these two giants(PHP & Javascript) of the web is to combine them. Trust me, it's the best thing.