What is the future of PHP? Is it really going away as some people say?

You may have heard how the new WordPress  Gutenberg editor brings block-based editing to WordPress.

There is a change behind the scenes that the average user may not notice, Gutenberg's blocks are made in JavaScript (React, JSX and ES6) instead of PHP . This change, along with other shifts in web development, may make you wonder, "Is PHP dead?".

So...is that so? Should we call the funeral home and start preparations? Well, the first thing to point out is that there is a big difference between wishing PHP would die and actually having PHP die.

People have been calling for the death of PHP for years (you can find a "Is PHP dead?" post from as far back as 2011). However, PHP still exists...

In this article, we'll dig into the data and show that PHP is not close to death (even if you really want it to be).

Is PHP dead? This is only true if you ignore PHP usage statistics

Well, PHP may not be the best or most modern programming language. But that doesn't mean it's dead, and it's hard to argue with the PHP statistics here...

First, let’s see what W3Techs has to say.

According to W3Techs , 78.9% of all websites with known server-side programming languages ​​use PHP. Therefore, almost 8 out of every 10 websites you visit on the Internet use PHP in some way. Which brings us to the fact…

PHP will not die

PHP will not die

To be fair, that number is declining. In November 2017, W3Techs cited PHP as the server-side language for 80.1% of websites. In June 2018, this number dropped to 79.6%, and now as we publish this article in November 2018, it has dropped to 78.9%.

However, you also have to be cautious with some statistics. Some of these scanning tools only look for  X-Powered-By HTTP headers. Some hosting providers remove these headers from broadcasts on their servers for security reasons. So, in fact, the number of websites using PHP is probably higher.

But when the number is still over 75%, it's hard to use this decline to declare the death of PHP.

If you think about it, these numbers really shouldn't be surprising. First, WordPress, the most popular content management system in existence , uses PHP. Considering WordPress powers 34% of all websites on the internet , that’s a lot of websites using PHP. Wondering which PHP version you're running? See our guide on how to create a phpinfo page.

But it’s not just WordPress either. There are tons of other websites, large and small, built with PHP. For example, MediaWiki, the software behind Wikipedia, is written in PHP. Oh, by the way, both Drupal and Joomla also use PHP.

PHP is also faster and better than before

In the latest PHP version, PHP is faster than before. Our recent  PHP benchmarks show that PHP 7.X performs significantly better than PHP 5.6.

In our tests using WordPress and popular e-commerce plugins like WooCommerce and Easy Digital Downloads, PHP 7.3 produced 2-3 times more requests per second than PHP 5.6. And the recently launched PHP 8.1 is even faster.

PHP benchmark for WordPress 5.0

PHP benchmark for WordPress 5.0

Even better, PHP 7 also competes well with other languages .

In addition, PHP 7.X version also brings new improvements to developers, such as:

  • Combined comparison operators
  • Null value coalescing operator
  • new type hints
  • anonymous class
  • Types that can be left blank
  • Return of Iterable and void
  • Multiple catch exception handling
  • Keys that can be used in the list
  • trailing comma
  • More negative string offsets
  • Numeric operators and malformed numbers
  • HTTP/2 server push

Of course, you'll only notice these improvements if you actually use the latest version of PHP. Unfortunately, this is often not the case.

According to WordPress.org , approximately 64.0% of WordPress sites use PHP 7.1 or lower, and 22.9% use PHP 5.6:

WordPress PHP version statistics

WordPress PHP version statistics

As of 2018 and 2019, PHP 7.1 and below are no longer actively supported and have lost security support.

With so many websites running on a version of PHP that has officially reached the end of its life, this can be detrimental to PHP's reputation among developers.

Finding PHP developers is easy

Due to PHP's popularity, it's easy to find PHP developers. And not just PHP developers – but experienced PHP developers.

What's more, PHP developers themselves seem to be doing a pretty good job, as Brandon Savage so eloquently pointed out on Tweet.

For newer frameworks, it can be difficult to find developers, especially experienced ones.

What's more, sometimes experience isn't possible without a time machine. Humorously, in the Reddit post , there was a job description that required a React developer with 5 years of experience. This was in 2017, and React had only been around for 4 years.

Except to find. As a PHP developer, it is relatively easy to learn this language . To help you, we have collected some of the best free and premium PHP tutorials in this article . Happy studying!

You don't have to like PHP, but it's not dead

You may not like PHP. Heck, even though we are an application, database, and managed WordPress host, we would be lying if we said all of our developers love PHP.

In fact, our member center, online tools and theme plug-in backend management are built on Node and Vue, which are all based on JavaScript, not PHP. However, not liking PHP doesn't mean it is dead, or even dying.

Bjarne Stroustrup, the creator of C++, has a very pertinent saying here :

There are only two languages: the language that people complain about and the language that no one uses.

Yes, PHP does seem to be losing some steam, according to W3Techs. However, even if PHP declined at the same rate, it would take more than 25 years for PHP to fall to the 50% level

Finally, all these posts about "Is PHP dead?" are really just examples of Betteridge's Law of Titles - "Any title that ends with a question mark can be answered with the word no".

What do you think? Is PHP dead? Do you love PHP? Do you want to suffocate PHP with a pillow? Let us know in the comments.

Guess you like

Origin blog.csdn.net/weixin_44026962/article/details/135454315