You don't hear much about PHP these days in online communities or in tech blogs in general. And that might have you thinking that it's perhaps a dying language not worthy of your time in 2021.
There are plenty of other newer tech stacks currently on the market that are trendier and perhaps even more useful, depending on whatever it is that you are trying to accomplish.
So is PHP still something that you should consider learning in 2021?
Let's talk about it.
PHP is popular for a variety of reasons.
- PHP has been widely ported
- Can be deployed on most web servers on almost every operating system and platform
- Just in time compilation
- General purpose - Can be used for other tasks non web related
- Does not depend on data types
- A passionate community
That last point is important to put a little more focus on, because it's probably the reason why PHP has such massive adoption rates.
I've tried to setup and learn PHP in the past. And time and time again, I have failed to do so. That's probably because I'm a .NET Developer and whenever I see any other framework, I can't help but to compare and criticize.
But every PHP developer that I know, loves PHP. They enjoy the language at a level that I simply can't understand, because it takes years of using it daily to probably see what the fuss is all about.
Why the hate?
So why is PHP criticized so much? Why do people think that it is an outdated and dying language?
Well, it's probably because PHP has terrible branding. For one, it's logo looks like it was made in 1994. It looks like maybe it should be deleted and started over from scratch.
You might think that I'm kidding here. I kind of am. But also I'm kind of not. The reason why the newest languages and frameworks grow in popularity is because they tend to have marketing teams behind them putting in the silent work in the background to reach the masses and spread.
Most of these languages are created and maintained by some of the biggest tech companies around, which means that they can afford to have blogs, banners, logos, contests, social media posts, YouTube videos, etc in order to get people to download their compilers and join their ecosystems.
PHP is not one of those languages.
Why to like?
There's alot that PHP has going for it. Alot. More than many other programming languages. For one, it's been around for 26 years as of this writing. And that's not a bad thing, like some would believe.
You would rather have your doctor have 26 years of experience than 5 years. They aren't outdated, they are just skilled.
Aside from its longevity, PHP is heavily documented, all of which can be found on the official PHP website. And if there is a question that you might encounter on it, yes, it has been solved and the answer is somewhere online.
PHP is also one of the easiest languages to learn, mainly because it is a scripting language.
That right there is a fully functional PHP script.
Other programming languages, like C# or C++ require projects to follow certain protocols before you can consider them valid programs.
For example, you might need to declare header files in C++ or you might need to create a namespace and class hierarchy if working with C#. And even then, the actual implementation would depend more on the type of project. For example, ASP.NET Web Forms require vastly different configuration than ASP.NET MVC 5.
And if all of that mentioned was confusing, then that's the benefit of PHP right there.
Should you learn it?
This is a tough question to answer for a number of reasons that I will attempt to break down.
First off, there is no right or wrong answer. Learning anything will just make you int a better asset overall. By that I mean that I wouldn't consider someone that knows less over someone that knows more.
So if you want to learn PHP, you'll have to learn it the way that most of us learned new programming languages over 10 years ago. By installing it, configuring it, and trial and error.
You might not learn PHP in 1 hour, like some YouTube videos have you believe, but within a few months of daily use you can definitely start to learn how to navigate the language effectively.
The biggest benefit of learning an older language like PHP is in the market share that it has. There are many companies that rely on PHP currently as their primary language. That means that the job market is wide open for anyone willing to learn it and learn it well.
CMS's like WordPress are built in PHP, and currently WordPress makes up about 60% of all websites published on the internet.
Where to begin
If you are interested in picking up PHP, then good on you. The best lace to start is on the official site where you can download the latest version of the language, PHP 8.x.
You will need to setup the appropriate tech stack to run PHP. That might mean different things depending on your environment.
For most though, it will mean installing the Apache web server and then creating your first PHP application and ensuring that it runs.
You should also install MySQL on the side as there is a good chance that this is the database server that you will be working with on your projects.
After that, see where the language takes you. Eventually you will start to see why so many developers have used it as their language of choice for almost 3 decades.