今日推荐英文原文：《The Future of PHP》
今日推荐英文原文：《The Future of PHP》作者：Daan
The Future of PHP
Is it a dead programming language?PHP has had better days, for sure. But is it really dead?
On a forums like StackOverflow people are suggesting that PHP is dead. Do they have a valid point, or could it be that they just don’t like PHP?
Let’s take a look at PHP and see if there is a future for this programming language.
PHP is Still Dominating the WebIf you take a simple look at the numbers PHP is definitely not dead. PHP is the most used server-side programming language by far. Approximately 75 percent of all webpages are powered by PHP. Take a look at the graph below and see how far PHP is ahead of its competition in terms of how often it’s used. It is fair to conclude that PHP isn’t dead based on this statistic since 75 percent is far too high number for a dead language!
One of the reasons that PHP is used by so many websites is because WordPress uses PHP. The market share of WordPress is approximately 34 percent of all websites. That’s 75 million websites using WordPress.
Furthermore, there are some other CMS’s like Drupal (3%) and Joomla(2%) which also have a significant share of the market. And there are some popular shop management systems, like Shopify, which have around 1 percent of the total market share.
A lot of big content and shop management systems are using PHP, which makes PHP important and relevant.
Building Websites From ScratchI can see the argument about building websites from scratch since a lot of people, who use WordPress for example, don’t know how to code. Making a website in WordPress does not require you to know how to code. A lot of people who have a WordPress website probably don’t even know that it’s powered by PHP. So is PHP still used by people who build websites from scratch?
PHP was and still is a very popular language. One of the reasons for this is that it’s a really easy programming language to learn. That makes it an excellent language for people new to building websites. PHP can be learned without any prior knowledge. I think it’s fair to say that most web developers that have been around for a while probably started out with PHP, or at least have worked with PHP at some point.
ProgrammingSince PHP has been around since 1994 the language has got a little cluttered over time. There are a lot of ways to build the same functionality and a lot of these ways are pretty hacky. This makes it easier to write bad code in PHP. Obviously, it’s possible to write bad code in any language but PHP makes it a little easier because of the way it has grown.
PHP has been around so long it also has a lot of old stuff. This makes it easy to get started with PHP, but if you stick to the old solution you end up with suboptimal code that doesn’t follow best practices. And this is something that you should really try to avoid. Not following the best practice is something that will happen when you’re inexperienced with PHP since it is not always clear what the best solution is. This is because there are a lot of ways to solve the same problem. This is one of the reasons why ## PHP is hated by some developers.
On the other hand, you could argue that most web developers don’t write raw PHP. Most of the times you will be using some sort of framework that does a lot of things for you. A popular PHP framework that is very clean is Laravel. The advantage of working with a framework is that a lot of the dirty work is done under the hood. The framework forces you into writing cleaner code.
PHP 7Since the release of PHP 7 a lot of new features and improvements have been introduced. The two most significant improvements are improved speed and better memory usage. This means that websites that use PHP 7 load faster than websites that use an older version of PHP and can handle more users at the same time.
Code wise, type declarations and new operators have been introduced. Error handling has also been improved.
JobsSince 75 percent of the web is powered by PHP there will obviously be a lot of jobs involving some sort of PHP coding. All these websites need to be maintained and there are PHP developers needed for that. The enormous market share of PHP won’t be gone overnight, so jobs involving PHP will be around in the future.
If you take a look at this link to the jobs section of StackOverflow you will find a lot of jobs that require PHP.
ConclusionAlthough there is a lot of discussion about the future of PHP, it is clear that PHP does have a future. It is by far the most used programming language for websites.
PHP has been around for a while now and this is reflected in the code. There’s a lot of old stuff that means the best solution is not always clear. Code wise you could use a framework that does a lot of the dirty work for you and forces you to write cleaner code. However, since the introduction of PHP 7, a lot of things have improved.
If you want to start a career as a PHP developer you won’t run out of options when it comes to finding a job. There are plenty of jobs involving PHP skills and this will stay the same in the near future.
So what do you think about PHP? Do you think there is a future for this programming language? Or is it dead?
Thanks for reading!