PHP Future

I have read that PHP is falling by the wayside to make room for newer, better scripting languages. I hope that this is not true because PHP has served me well for many years. I find it difficult to believe that another server-side scripting language can provide more than PHP does and has done over the years.

That said, what scripting language should I be aware of that may be - or is - a current replacement for PHP?

Thank you.

I don’t know anything for certain, but I can’t imagine PHP disappearing any time soon. When you consider the sheer number of websites that rely on it, and a number of popular CMS and frameworks, it would leave a big hole in the web if it went away.
There are other languages you can try, I don’t know a lot about them, as I have not tried anything else, Ruby is one, but I’m sure there are more.

Thanks for your comments.

I was surprised when I heard a very well know/respected web instructor say that there were more modern alternatives to using PHP. He was not ranting, he just mentioned it in passing and this gave me pause. Thus my query here.

My head hurts from all of the ‘new’ web ‘apps’ running loose in the wild. PHP suits me just fine, but I am open to anything that will make my web building easier. I am assuming that the end result will be superior in some way.

I’m good.

Thanks again for your thoughts.

1 Like

PHP will not disappear anytime soon, so I would not worry about that.

The fact that X said that, does not mean that it is correct. It can be their personal opinion, but no means does this mean you should drop PHP and move on.

There is no best/worst language, of course, different languages are better/worse at specific tasks. This is why you need to make a decision based on the task at hand, and decide if you will use language Y that is faster to do this, or stick with language X, that while it is slower at executing the task the development will go quicker since you know the language.

On a side note, if you are looking for a different language, I would not recommend Ruby. Instead, look at Node.js it complement PHP very well, is quite popular now and can also very easily be used as sole language for a project.

2 Likes

Keep in mind that PHP runs a significant portion of the Internet. It runs WordPress which has between 35-40% of the world sites and about 15-17% of the top 500 websites. Besides WordPress, it also runs the number 2 and 3 CMS’ which include Drupal and Joomla.

Believe me, it is not going anywhere anytime soon.

2 Likes

I also read somewhere that Facebook uses an extremely modified version of PHP, but I don’t know how true that is?

Ah, Node.js. That was mentioned in the conversation about PHP as I recall. So that was probably why the statement about PHP was made, if indeed, Node.js is superior to PHP in some way. I know very little about Node.js, which is why I never made the connection.

I am truly comfortable with PHP and appreciate all that it enables me to do. I do have plans to take a look at Node.js, but if PHP ‘ain’t broke’, why bother fixing it?

Thanks for your comments.

1 Like

Thanks for your comments.

From what I am hearing, I have little to fear about the demise of PHP in the web development environment.

It’s pretty true. Facebook says they’ve dropped support for PHP, but you can still stick a PHP class inside of Hack.

This is the class I wrote for Hack.

class Author {

	public function __construct(public string $first_name = '', public string $middle_name = '', public string $last_name = '') {}

	public function name(): string {

		$middleName = ($this->middle_name != '') ? ' ' . $this->middle_name : '';

		return $this->first_name . $middleName . ' ' . $this->last_name;

	}

}

$author = new Author();

$author->first_name = 'Edgar';
$author->middle_name = 'Allan';
$author->last_name = 'Poe';

print $author->name() . "\r\n";

And this is the class I wrote for PHP.

<?php
class Author {

	public function __construct(public string $first_name = '', public string $middle_name = '', public string $last_name = '') {}

	public function name(): string {

		$middleName = ($this->middle_name != '') ? ' ' . $this->middle_name : '';

		return $this->first_name . $middleName . ' ' . $this->last_name;

	}

}

$author = new Author();

$author->first_name = 'Edgar';
$author->middle_name = 'Allan';
$author->last_name = 'Poe';

print $author->name() . "\r\n";

The only difference between the 2 different codes are that for the PHP one, it has the starting PHP tag. Other than that, identical code syntax. And if you look at the version of HHVM I’m using, it’s 4.8.8 which should supposedly have removed support for PHP because Hack version 4.0 was supposed to have dropped support for PHP.

1 Like

More Importantly, PHP is still being updated. The argument that 60% of the web is based on PHP, would only mean legacy support for an ever dwindling number of sites. PHP is still evolving forward and new sites are being written in the language and new implementations are being created.

PHP has always had it’s lovers and haters, but there is no need to worry for its existence.

1 Like

No, it’s def not dying. Despite the rumors circulating, PHP is still going strong in 2021. The thing is that there is a wider choice of backend languages than it used to be years ago. Therefore, PHP is not just omnipresent anymore in the backend, but is still among the popular alternatives.

2 Likes

“I don’t like how language X does this.” “So write your own.” “… okay”
-The birth of 90% of programming languages.

It would be foolish to suggest that programming languages are stagnant; they’re not. are there “more modern alternatives”? Yup. There always will be; there are “more modern alternatives” to python, and java, and C++, and C#… but they’re all still used.

Just because an alternative exists, doesn’t mean it will supplant the previous language.

How’s that laserdisk doing? :wink:

1 Like

My personal opinion is that there is no “superior” language, some are just better suited for a task.

For node.js, the advantage is that it is asynchronous which means it is very quick as long as you have nonblocking operations.

On the other side, the second you have something you want to do that needs to be blocking, it is more difficult to work with. For example create an set of database records where one depends on the other, and they need to be entered into order. (Still possible, but require more work than in PHP).

On this note it is possible to create non blocking PHP as well, and there is several interesting libraries that does that, giving you a similar speed boost that you would get with Node.js.

1 Like

There have been chicken little cries of “the sky is falling” with regards to PHP’s pending demise for decades. The only way PHP could die is if browsers decided they would no longer interpret and render PHP code, right? I mean, with version 8.0, you have the most robust version available, ever. And I do believe there is not much that cannot be developed using PHP and javascript, so I’ll be using it till I’m done, I would guess. If browsers decided to stop using PHP, it would make the Y2K crisis-non-crisis seem like a hang nail, by comparison. I, of course, have already done my own stream-lined browser to package with my web apps, so, even the lack of popular browser support would not accomplish much to stop PHP. So, when you hear these rumors, be a smarty pants and just laugh at the perpetrator…

I was under the impression that PHP scripts are interpreted on a server and only generate HTML script. Browsers can only render HTML script.

3 Likes

I’ve also read similar articles and believe the authors have limited knowledge of PHP and mostly trying to promote other languages.

PHP First appeared 1995 - 26 years ago

I came from a C and Pascal background which are/were remarkably difficult to build web pages so had to learn PHP because it could handle databases! First impressions were to be amazed at the "weak typeing (Wiki) and learnt to accept but strongly objected to the programming methods.

PHP has certainly changed since the early days I’m delighted to say and not only introduced Strict_typing but also now has a JIT compiler. This is certainly a vast improvement and looking forward to experimenting.

Unfortunately for PHP the Internet/World Wide Web has vastly changed since first starting late last century. PHP now struggles to handle web-pages that have many hits per second. New languages have been developed to cater for sites that have vast traffic and subsequent computer processing. The Stock Market springs to mind as one such site and also Facebook.

New languages such as Golang, Rust are example languages that have been developed to cater for these cases.

It will be a very long time before PHP “falls by the wayside”.

yes, PHP, a Hypertext Pre-Processor (Dont ask me why that translates into PHP instead of HPP), processes the file at the server end, and returns… i will say browser-interpretable code (again, PHP is perfectly capable of mimicing any output; javascript, HTML, jpg data, etc. It’s perfectly valid to put into your img tag’s src a PHP URL, as long as the PHP page returns something that looks like an image).

2 Likes

Wiki quote:

.[8] PHP originally stood for Personal Home Page ,[7] but it now stands for the recursive initialism PHP: Hypertext Preprocessor .[9]

1 Like

You are absolutely correct. Even as I typed that I knew it was incorrect. DOH!

2 Likes