The whole shared-nothing request container architecture.
In each request you have a clean state with now left overs and some guarantee that you are not piling up memory leaks over requests. This allows easy scaling. Since recent additions like preloading to the engine the performance cost of recreating the world each time is also heavily reduced.

This greatly matches the HTTP model and makes PHP the true web language for the server side.
This is the best and the only valid answer from all of them. But it is good to know, this feature is a two edged sword.
You must only use PHP when it fits for the use case. (Please don’t try to write Prometheus exporters in pure PHP, you will cry.)
This.

I think the main thing that made it so good at HTTP apps, is that it (php3 since before that it was massively different) basically started off as an apache module. It made deploying PHP apps so easy. And made it designed for web apps and it just kept on carrying on. Before that it was just a pain with cgi.

Fast prototyping. You can spit out a proof of concept in PHP faster than you can boilerplate Hello World in some other languages.
I’d point out that PHP is very fast and will suits well many use cases.
On the web, by using the Fast CGI it remains very flexible and its shared nothing architecture brings many advantages for free.

Php also has drivers for many databases out of the box, and a unified interface to handle them.
Liking or not, php arrays are gods and allow fast prototyping.
Last and most importantly, it is one of the few truly open source languages out there

It has a strong gradual type system while being a scripting language that doesn’t require compilation or transpilation.
One of the best things about it is how well it integrates with HTML. When I came across PHP, I was already familiar with Perl. I soon favored PHP over Perl, because I could use it within HTML. To display HTML with Perl, I would have to display it as text with a command. But with PHP, I could just interrupt my regular HTML for a bit of programming code.

It also helped that PHP’s syntax was very much like C, which I was already familiar with. This made it easy to pick up. Since learning PHP, I have not found the need for using another server-side web programming language. Well, aside from the one I wrote in PHP, but its use is specialized.

Perl had things like embperl even before PHP came around. The problem was that getting perl support beyond CGI required mod_perl (fastcgi hadn’t taken off at the time), and that was a cast iron b*tch to install at the time compared to PHP. To say nothing of actually managing mod_perl apps. I’m convinced that was what allowed PHP to eat so much of perl’s breakfast, and I say this as an old perl grognard.

Nowadays mixing logic into templates is frowned upon even in PHP, but the 90’s were a heady time…
Grandpa spotted. (I’m probably as old as you but I think op meant today )
That’s the one thing about PHP I don’t like, at least, I don’t use it. All my .php files start with an opening tag and have no closing tag. For anyone who finds the mixing of HTML and PHP confusing or ugly, too, try it out, you might never turn back 🙂

I don’t like the “html” integration at all. Its just string interpolation, no xss protection, no component architecture, no knowledge of syntax or attributes.

I suspect PHP’s lisp contemporaries (thinking 1995 viaweb) did this better.
PHP is simple to setup, use and debug. Dead simple.
You decide over a vast range of how complex you want your project to be.
PHP is executed in a way that seems natural to web based connections and technologies.

PHP syntax and language constructs lend incredibly well to database queries and user sessions without the complexity of user states, synchronization issues, access issues or connection woes.
All of this makes it a fast way to design and implement services quickly.

But you must remember that every project has unique needs. Even if all of the above sounds highly relevant it only takes one other metric or feature or maintenance goal to merit another language or framework. It is not about the strengths and weaknesses of languages, it is about what your app needs.
elephant

I’d add PHP’s backward compatibility with older versions and how outdated language features are slowly transitioned away. I’m reasonably confident that the code I wrote in PHP 7 will work in PHP 8. There might be some notices for deprecated features for me to address but the code will still work. So updating to the latest version isn’t as terrifying/time consuming as it would be were I to update my version of Ruby or Python.
easy and straightforward html embedding

It’s just a bunch of files. Unless you do something crazy or stupid, you can generally just put them somewhere, anywhere. I can sync my stuff between laptop and desktop in seconds and work on the same stuff on each, because it’s all in the files. I have 10-15 year old things that still work (some of it needed tiny changes through the versions of PHP, but nothing that took more than a few minutes). My CMS I wrote 9 years ago went from an average page generation time of 100ms to 35ms, just by going from initially PHP 4 to 5 and then 7, no code changes. I like that in software.

I also like refactoring or making things again from scratch, but only because I want to, not because I’m glued to some fad-driven “ecosystem” that forces me to.

What I make generally doesn’t require anything fancy in php.ini or special modules, admittedly am not making fancy things period — “it’s the simple things that please me” anyway, to quote Heather B. I fully understand that for other stuff, the benefits are outweighed by the drawbacks, but in my case it’s so much the other way around, it’s not even funny.

Actually it is, I’ve been chuckling ever since the PHP hate began (“fractal of bad design” posted over and over and over), and quietly enjoying PHP being solid for me like few things in computing are, outside maybe HTML, CSS and Javascript.

Also, you can use it on any cheapo webhost, even some free ones. As someone who considers programming and making websites a form of literacy in these times, that’s a big one for me, even though Also, just to add more snark (I’m not even a PHP fanboy really, I hate fads more than I love PHP, and making things needlessly complicated to kick away ladders, which nobody can convince me isn’t going on in webdev).. compare the minimum space requirements of something like phpBB with, say, Discourse (a darling of that wave of web hipsters) who at some point recommended a TEN GIGABYTE minimum for a basic install.

For a forum that doesn’t even have a single post in it. They since removed that bit from the guide, but I doubt Discourse got smaller. I’ll take some weirdly named functions or having to look up argument order a lot over that level of insanity any time of the day.

I don’t have to deploy an app to a remote server and start it up whenever I want to make a change. I just upload the file and done.

The standard library, with it’s goods and bads, is for sure something that differentiate PHP from other languages, or at least, from some of them.
one of the most important and most neglected points to consider in any discussion about programming languages is the scale of the language’s ecosystem. More websites and web applications have been built with PHP than any other language.

Every problem you might need to solve has already been solved by countless other people. Some of them have written blog posts about it, answered questions on stack overflow and many have packaged up their tried and tested solution and made it available as free open source software.

There are PHP user groups and annual conferences in cities all over the world. There are numerous frameworks that have matured and grown to be interoperable. There are different communities to satisfy different development preferences whether you prefer rapid development and expressive syntax or strict apis and extensible design.

I’ve played with all the shiny new languages as they come in to popularity. I played with Golang, Rust etc. I loved the language features but those features just weren’t useful enough for me to turn away from a mature ecosystem where most of the problems I have to solve have already been solved for me and I can be as opinionated as I like without being constrained by limited choice.

Is it just me or are there a lot more “magic” class functions in PHP than other languages? I really love them.
I also love the built in type hinting while not being required
Python’s magic methods put PHP to shame. Perl has a lot of magic too, though anything beyond AUTOLOAD and operator overloading is fairly deep magic. It actually calls it “magic” too.

Many libraries useable and compiled / linked in on numerous Webhoster companies.
I guess PHP will die only if we have a decent php to python transpiler AND the same library support being standard in the PHP ecosystem / on most Web hosters.

source

Categories: CodingComputer SciencePHP