PHP in 2022
stitcher.io
stitcher.io
All I need to get to work is VSCode and some linux VM or container. PHP has an obnoxious amount of depth. You can become an expert on just ORMs or just SSO or just Collections or just routing and still be learning something new everyday. I am actually "self tought". Whatever that means.
What does that mean? I know what taught means, but tought? No idea.
I have moved on to other languages like JS and Python since ~2012. Looking at the article, I feel like modern PHP is almost a completely different beast compared to when I used it back then >_<
I’m mainly a C# guy myself as far as the backend goes, but I don’t view PHP as being bad in 2022. I think people who do are stuck in the past to be perfectly honest.
It’s sort of like disliking JavaScript because it really sucked the soul out of you before typescript eventually made it nice to work with.
But being mad at any programming language is sort of silly isn’t it? If it works it works.
PHP has always been considered as a somehow bad language in all corporations I've worked at to date. The same applies to other script languages such as python, ruby or nodejs - but PHP was the most undervalued of them all.
It's kinda strange because the language is really performant and relatively easy to use.
Maybe that's exactly why the big brain architects don't like it. They do tend to love things correlated with pointless complexity after all
Many of these decisions revolve around the authors not wanting their functions to fail under any circumstances. This is nice for beginners but quickly hurts more than it helps in larger projects as it obfuscates bugs.
But, if you genuinely want to know why some of us hate on PHP, I can tell you the reasons that I would never choose PHP for a production backend (now, I do think PHP is a fantastic scripting/sysadmin language- better than Python for sure, but I don't know Perl well enough to judge against that).
PHP is single-threaded. I feel like that's a pretty decent reason all by itself to not want to use it in an enterprise environment.
PHP is not really async, either. Yes, there are are run-loop libraries, and some libraries even claim to be async all by themselves, but these solutions are awkward and cumbersome and easy to use incorrectly.
PHP's array data type is ridiculously bad. In every conceivable way. If you want to use it as a contiguous, linear, collection, then it's slow and bug-prone (e.g., using array_filter, but forgetting to wrap it in array_values). If you want to use it as a dictionary, then it will sneakily convert your keys into numbers which doesn't matter until it does (like when trying to operate over filenames in a directory and someone named a file "1". Then you try to do some operation that expects a string and your code explodes several hours into its operation... Ask me how I know).
PHP's iterators and other, more professional-grade, data structures are not as "first class" as plain-old array, so nobody uses them. IIRC (it's been a while), you theoretically need to enable them in your php.ini and/or install them at the OS level, which kind of kills the whole "PHP is so easy to deploy! Just FTP a file and you're done!"-thing.
I prefer static typing to dynamic typing. PHP's static typing is weak (as in not strict enough) and not expressive enough for me (no generics, no sum types, no extending classes/types).
PHP does not allow for custom equality definitions. Also, since everything is references, I believe you can blow the stack if you try to check that two objects are equal that reference each other.
The architecture of every HTTP request getting a fresh instance of PHP is actually pretty nice. And a ton of work has been put into the language/runtime to make sure it's stupid-fast at ramping up and parsing the request data. HOWEVER, as soon as you slap one of these popular frameworks (Laravel, Symfony, etc) on top, you've basically ruined it and made it slow, with all of the extra framework initialization junk. I remember seeing engineering effort go into "compiling" Symfony code to make it load quickly (I don't remember how Laravel works). But think about that for a second- we're going to choose an interpreted language that can't cache any state beyond a single request, and we're going to add a COMPILE STEP to it?! So that we can work against the init-process-teardown cycle that it's designed for? Are we really sure we actually wanted to use PHP?
I used to have more specific complaints about strings and the numeric types, etc, but it's been a little while since I've had to write any PHP (I haven't used version 8, but I was using 7.4, I think, so I'm still fairly immune to the "You only remember PHP before it became awesome in 7+." criticism).
I'm more than sure that any regular PHP dev has no problem dismissing all of my complaints. Just like when I went to the doctor and told him my elbow hurts when I bend my arm. He told me to stop bending my arm! Problem solved. ;)
[1] https://www.i-programmer.info/news/98-languages/6758-the-rea...
Since you mentioned Python: I would never think of using Python instead of PHP, at least not for a web-based project. Performance-wise PHP is (I think) better thanks to all the work Facebook sponsored, and it has all the "batteries" needed for web development included, so the only reason for choosing Python would be that it's maybe more "elegant".
The performance improvements where not directly sponsored by Facebook.
But some old timers (genX) still today bemoan php as if it had no progress made.
I've recently tried to help out a friend who got stuck with a half-finished PHP project and a deadline to deliver, I have not touched PHP in 10 years and it still has the stench of a bad language from the get go - "modules" requiring VM config, "include" files ... what is this 90s ?
PHP might have had a huge patchwork competent people did to keep things working once projects using it grew enough, but coming back to it after 10 years it still felt like it was built on a foundation of shit.
Also, any language that is used in real life is built on a foundation of sh*t only. The component loading with python is so bad that I have programs keeping their own version of python and IDE suggesting I create VM for my project. The situation with C is so bad that no one can solve my linker problems unless I switch the toolchain version. For a long time Javascript was a (purpose built) toy language to sprinkle pixie dust on web pages. Any sufficiently complex problem requires either deep knowledge or following convention (tribal knowledge specific to the context)
I am balancing my love for it with the public perception I have seen over the years (fortunately I think much of the vitriol has waned sorta), in terms of how bashful I feel whenever discussing anything coding-related as to not overstate what I know/do. Most people, I think, grow out of php, so I see myself as a bad stereotype in still using it. But it has done a lot for me in terms of confidence building, being able to make things, the creative process of turning nothing into something, even though admittedly if I'd picked a different language I could likely say the same. But as far as staying with it, I feel like I look lazy for it, it just does what I want it to do. I am grateful for it. I hope this made sense.
That's from 2012 and many of the issues have been fixed since then, but it was the truth a decade ago and tainted the experience for many devs who have sine moved on to other languages.
Laravel is such a *joy*. I've never had this feeling of using something so easy and productive. I've been recently building a side project with LiveWire and oh-my-god. I really wish I had discovered it before. From the templating system (you get components out of the box! no more "includes" if you don't want to) to the validations, to the queues system... everything is so well integrated and so easy to use.
For the last decade I've worked mostly with Django and SPAs, I'm not going back to that any time soon. Django templates are extremely limited for nowadays requirements, and SPAs are 1000x more complex to build and maintain so in my opinion they're not worth the price/effort. I think Livewire, Hotwire, Unpoly, Htmx, etc are what 90% of web apps need.
- I prefer things to be more explicit than implicit and lean more towards configuration over convention.
- I lean more towards having types/typing information than not having it
- PHP is way, way, way more used than Ruby
- Performance (just talking about development environment performance) is a lot better in PHP (no server restarts, etc)
- Availability of third party libraries is a lot stronger on the PHP side, probably due to it being more popular
- Tooling and editor support. This is a big one for me, and I've found out things to work a lot better with VSCode for PHP than for Ruby. Probably related to it being both, more popular and more explicit.
- Overall, Laravel feels even more complete than Rails and just fits better my brain.
But, I think Rails is still great, and I would use it over building a microservices mesh of Go servers on kubernetes with React frontends, etc, etc.
It's also slowly being integrated into JS frameworks although they're still behind as the focus has been clientside and static generation so far.
Feels like BE-first dev and non-SPA/JS centric client webdev is slowly regaining ground. Exciting.
Last time I tried to use Livewire with Vue, it had some issues which caused Vue to lose reactivity. (Maybe Livewire removed the DOM where the Vue instance was rendered. There was some options that prevented livewire from replacing elements with given id/classname.) But if i remember correctly, you cant have livewire element which has vue components as child elements.
Maybe i was doing stuff wrong or the livewire<->Vue compatibility is a bit better nowadays. Or maybe its because I'm too used to Vue.
It felt like the Laravel community jumped to the Livewire hypetrain quite fast and it feels like the livewire recommendation to use alpinejs in someparts is required. And most of the examples for alpinejs requires you to write inline code. (It is possible to split the code to own js files, but then again you are building something that gets closer to Vuejs.)
It feels weird to recommend to write scripts using inline javascript. That requires more CSP modifications for security and also the scripts wont get cached and are loaded every time the page loads. (If I'm correct.)
TL;DR Livewire is great for small features.
In my opinion, when everything breaks down (and not saying this is your case, just what I think) is if you try to do every interaction with Livewire (thus reaching for the server when you shouldn't) or when trying to mix in SPA tools (such as Vue, React, etc...) with it. I suppose you'll end up with the worst parts of every solution.
PHP is such a joy that I am really thinking about switching back to it for my day job.
My iteration cycle is very fast. No need to sit there and wait for compiles. PHP is C-like and written in C so the hate is funny to me. Our code is unit tested, documented, and extremely well organized. I even connect to our database on my dev box through an SSH tunnel managed by a tool I made for us in.... PHP which uses AWS IAM to authorize a private key for 60 seconds and then auto connect. That's how I connect to our EC2 instances too.
I'm now jumping to another successful start up with a small team running Laravel. Again super organized and well documented.
In fact the most C-like thing I remember about it is that many standard library functions where extremely thin wrappers around the libc, so thin in fact that you could get a segfault if you weren't careful.
You didn't realize how many people hate C? (Like any other popular language, yes)
> This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.
Ref: https://stackoverflow.com/a/59293198/368328, https://3v4l.org/rQGk2
For those of us in the PHP industry, I feel that the most concise way to stay up to date is with Brent's commentary and the Jetbrains PhpStorm blog.
Unlike other "x in 2022" articles (for example https://www.ncameron.org/blog/rust-in-2022-2/), this one doesn't actually give any insight into the future of the language. Not only that, but there is no original content in it. He's simply repeating what he's been writing about for the past year. Maybe he should've called it PHP in 2021? Oh wait, he already did that (https://stitcher.io/blog/php-in-2021) and it's eerily similar to this article. If there is nothing new to write about, why write?
I'm glad you bring up the PHP Annotated Monthly blog, it's a great resource and definitely one of the blogs to follow to keep up to date with PHP.
> He wrote some decent articles before, and he might write some good ones in the future, but this right here, this ain't it.
Yes, I agree, this particular article is lacking.This article wasn’t done (and I’m still going to finish it, a “looking forward” section is missing)
I published it to get some feedback from the occasional reader, which I do more often. You can see I haven’t tweeted or posted it anywhere, I wanted to wait a couple of days still; so it’s a little unfortunate it got picked up here so soon. Of course I’m happy with the positive reception overall, but I agree that it’s not done yet.
On the part of self promotion within my own content: that’s just the way I’ve been doing it for years. I don’t feel guilty about mentioning other things I’ve made that I’m proud of and what I believe are high value as well. So on that part I don’t agree.
I do appreciate the overall feedback though, thanks for taking the time to share it
In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level.
I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and some of the frameworks were trying too hard to copy the Java ecosystem, all while Java itself was starting to modernize.
I'm curious what is the value proposition of the latest PHP version(s). Why would I choose PHP when starting a greenfield project? I know one of the easiest answers is that there's a huge amount of developers worldwide that know PHP, but apart from this obvious reason is there anything else that would make someone choose PHP ahead of other stacks?
If you want to build something once and get passive income out of it for the better part of a decade, PHP has your back. Pinboard is a prime example of this business model.
If you're a fast-moving startup who will replace your entire codebase every six months, you might be better served by JS.
> If you're a fast-moving startup who will replace your entire codebase every six months, you might be better served by JS.
Noooooo... :)
If it's a lifestyle business or hobby project, it usually costs less to host a PHP app somewhere than to find a place where you can get decent performance out of the JVM. Even a small droplet can be a lot of money and effort for some people in some parts of the world. I often see kids pick up PHP for this reason alone. Then they stick with what they know.
Because you don't know better. If all you have is a hammer, everything looks like a nail.
Ruby + Rails is miles ahead of PHP + Laravel. If you want more static typing (which I currently believe is a good thing) I really like Kotlin (+ KTor or + Javalin). If you are okay without OO and like static typing Haskell + IHP is pretty complete. If you are okay with learning about low-level stuff, Rust + Actix is really nice.
All of this may require learning new things, and coming from PHP that's a good thing. PHP and JavaScript are not languages that help you become a better programmer. They are messy and lack important features (sum-types).
Things are improving as more and more "batteries included" projects are launched, and it's better today than it was a year ago, so I'm happy about the positive change and I am optimistic about the future, but right now I can't begin to imagine labelling TypeScript as even close to being one of the "best" languages, because delivering software with it is a nightmare. TypeScript is great to write but hell to turn into JavaScript.
Wtf are you saying Willis.. but i guess it's a matter of preference, also consider that in PHP you can also use symfony which is my preference, but regardless of everything, you either come here with a list of things that make ruby on rails miles ahead or people is just going to classify your ideas as worthless
Is that a metaquote or something? Mr. Belvedere doing an impression of "the children's favorite programme?"
One can do some really beautiful programming in both modern JavaScript and modern PHP. Both these languages can and have helped millions of programmers become better programmers. Today's JavaScript and PHP are no longer the hacked up languages they once were.
For me, the answer is Laravel.
I think more and more people have started to realise that typed languages make better, more reliable software. The incremental additions to PHP's type system are just a move towards this, I think and can be seen in other languages such as Typescript.
I'm just not a fan of dynamically typed languages anymore, even for small scripts.
> Why would I choose PHP when starting a greenfield project?
I think it depends on your greenfield project, but there are many domains where problems are just solved related to e-commerce or shuffling around content online.
To this point, PHP benefits just from the fact that it has been around for so long, and will continue to be supported far into the future.
Many PHP frameworks like Symfony have LTS releases that will ensure software is supported years into the future, with strong support from agencies.
Sure— thinking you’re going to save time writing more complex applications by avoiding boilerplate is flatly wrong. However, if boilerplate would be a double-digit percentage of your code, you probably will save time avoiding it because any unlikely dynamic typing issues will be easily resolved. But if it’s small enough to be inconsequential and you’re in the typed-language zone, why not use your typed language, anyway?
Avoid dogma and use the right tool for the job, I say.
Well, I originally started programming only using dynamic types.
Then I moved to typed languages, and I could avoid whole categories of errors. I don't see it as dogma, I think typed languages are just qualitatively better at creating software. I also think this is starting to become industry experience, as efforts like Typescript, and the incremental additions to PHP's type-system show.
Every time I see a regular Map with nested maps, I get a little annoyed.
How about for the type of task PHP is often used for? A nearly default CRUD web app w/loads of fields and tables? Rapid prototyping? How about a bunch of simple, standalone interface interactions in JS? The extra grammar won't provide much architectural or conceptual clarity in those super common coding tasks because they're already dead simple, or in the case of the rapid prototype, don't need to be durable. Most data transformation— e.g. from the database into hashes— is taken care of by worn-smooth libraries that won't likely cock things up. For these tasks, front-loading complexity for little subsequent benefit is a questionable choice. Maybe you're so used to working with types that you're just as fast,time isn't a factor? Great. If you're not, or another developer you're working with isn't, and time is tight, it's probably a bad choice.
What many of these systems are starting to offer is the option of adding type hinting which is exactly what they should be doing. Python's type hints have been great in a new nontrivial project I'm putting together with multiple developers. If I had to use them for every bit of disposable utility script I write and every little prototype proof-of-concept I stand up then I'd be much less productive.
I reckon skipping situation-specific cost/benefit analysis before asserting something is always better is definitely dogma. ¯\_(ツ)_/¯
For everything.
As I mentioned, I started out using dynamically typed languages. I don't agree with your idea that types somehow make it harder to develop things quickly--even the throwaway things.
With types I get to grips with a new API quickly via autodiscoverability, and types provide guard-rails to know I'm using the API properly.
With types, I can avoid whole categories of errors, as even the "simple" things like, for example, processing a CSV file can mess up, when someone has accidentally entered a date instead of an ID and that ends up failing for the user.
It's not dogma to have an opinion that types provide a qualitatively better programming experience all around.
Many coders will never touch the complexity of most full-time developers' simplest code, and they deserve tools that meet their needs, too. How much future burden will explicit type declaration relieve for an indy self-taught web designer taking strings and floats from a database through an ORM and putting them into a for loop for a web-based coffee shop menu hosted on WordPress? I'd say none. Considering that WordPress runs 37% of websites and 62% of CMSs, I'd argue that there's plenty of room for blunt instruments to do blunt work. Insisting people jump through the types hoop for posterity is not reasonable.
As a long-time developer turned designer, I'm confident that using a "pack" layout strategy in many GUI libraries will consistently produce worse results than properly assembling a quick grid layout. I have my collaborators avoid it because using it == guaranteed re-write... but there's a lot of selection bias there. If teams involve someone like me, that probably means usability is paramount. As crucial as usability is, sometimes speed, convenience, and not needing barely-related expertise is more important. A developer making a dialog on a small internal utility should probably use pack even if I wouldn't. I have the patterns, organization, and syntax in my head to pull simple grid-based layouts faster than they will use 'pack.' For them, it's a bit of mental overhead for an already irritating task with no real payoff. Saying that languages shouldn't even make pack available to developers would be plainly unreasonable.
Even in the tasks you cited— I was a developer in a large library with a ton of older electronic assets. I processed significant amounts of CSV and other messy text files in many dozens of projects using everything from C, shell scripts, and Perl in the earlier days to Python, Elixir, and JS in the latter. I can count how often difficult-to-pin-down data type ambiguity burned me using zero fingers. I guarantee you having to futz around with types rather than throwing in an instance check or the like would have reduced my efficiency. If I had finicky or complex or relational data that needed to maintain integrity through a nontrivial pipeline, then I wouldn't think twice about implementing them.
In general, asserting that your way of doing something is universally better than other common ways of doing something is almost guaranteed to be dogmatic. For it not to be, you must provide a universally applicable truth that trumps individual use cases and people's preferences. "It avoids entire categories of bugs, near their source" doesn't work for people who will likely never encounter those categories of bugs. Insisting others are wrong for not agreeing with the accepted best practices of people who do regular professional dev work is absolutely dogmatic.
Otherwise, I think differences in syntax etc. are rather subjective and everyone has their preferences. For example, I really like PHP "arrays" because it removes cognitive load of choosing between different data structures. When writing business rules 90% of time I don't really care about optimization or memory, but about readability and communication.
Overall, PHP is rather dumb language and I love it for being dumb.
Python package management currently is a nightmare, but projects like Poetry seem on a good track to make it better. JavaScript is better than Python at package management, but it has issues with many small packages maintained by random people. Java ecosystem also seems quite a lot more complex, especially when you compare Composer and Maven. Compilation aspect also changes the way you work.
I have no experience with Ruby, C#, .NET etc.
Parts of the community seem to want to go over that limitation so things like Swoole and Roadrunner were developed. I guess it's interesting to have both options available even though much of the ecosystem won't readily function in both contexts.
While the ecosystem seems a bit weaker that what I would expect considering the number of developers (comparing to Java, Ruby, Python) I don't have a strong opinion on package management. I feel like all major platforms have gotten into pretty good shape on this front. Like you mentioned, if I start a new Python project I can just choose Poetry and avoid most of the drama.
1) CGI and similar share-nothing architecture like PHP, unaware of process model, threaded or processes, everything starts from zero. Any state needs to be handle outside of the runtime. Stateless thus a good conceptual fit for stateless protocol like REST.
2) Threaded frameworks like Java Spring or Python frameworks, the framework forks for you, but the architecture is leaky, you can share data between threads intentionally or unintentionally. Benefits from things like connection pools to be used between requests. Can be easier when need to handle a single mutex of a resource compared to 1), e.g only one job instance should run simultaneously. However most of the time you write code as if it was share-nothing, because fewer complications (no need to worry about locks, concurrent collections etc) and reduces risks of introducing any hard to debug and expensive mutex.
3) Single threaded event driven architecture, no need to worry about race condition thus you can keep global state within the application between requests, no locks or anything but with a big caveat, as soon as you start running your application as multiprocess, like cluster, that global state can no longer be used for data sharing, only for caches like database connection, thus the best way of writing application code is to write it as share nothing to avoid any state related bugs.
BUT single threaded event driven architecture also has a huge drawback, you can essentially freeze the entire application by programmer error or introduce hard to detect mini freezes because it is single threaded.
Proposition: the larger the single threaded event driven application becomes the higher the chance of freezing your application.
I think this is why nodejs shepherds you to write micro services and conversely PHP shepherds you to build monoliths because you don't care about the process model when writing PHP.
Conclusion: You should almost always design your code as share nothing. The only benefit of picking either of 1), 2) or 3) is for performance considerations outside of team expertise and community. 2) and 3) can have better performance than 1) due things like to connection pooling but 3) is bad choice in respect to longlivity because of the monolith mismatch. 1) is easier to reason about because the process model is irrelevant thus increasing longlivity.
LAMP stacks are super ubiquitous, open source, cross-platform, and in many cases to deploy your app you don't need to configure anything, add any modules or dependencies... just copy your files in place. A small project (e.g. contact form with a CAPTCHA) could be just a small file named whatever you want, which you can place anywhere in the public directory, and it'll work.
If you don't want to maintain the server you can get a managed VPS and things will probably run and continue to run for years without any intervention on your part, even through software updates.
... The exception is that PHP breaks backwards compatibility often, but even then most hosting services let you choose between different PHP versions which they'll maintain for a while. Installing older versions from package managers is very easy as well.
That said, I don't think this is a strong reason to use PHP in most projects. I do think it could be one of the strongest ones to justify its use in some specific projects.
In my case if the hosting provider doesn't have something like DigitalOcean's droplets I'll still rely on docker compose instead of the default stack deployed on the system whatever stack I'm choosing. But yeah that's raising the bar too much for most people especially for a couple of scripts or pages.
I've worked across a variety of different companies and a consistent theme is the existence of "php developers" in these companies, and the bad quality software they produce. I'm currently working at a company (founded within the last 5 years) and their php codebase is AWFUL (no structure, 1k+ LOC methods, no tests, no ci, no documentation etc.)[1].
The problem is not php, it's that a lot of PHP developers are doing the same thing they did 10 years ago, despite the industry having moved on. As a Software Engineer, I think there's a very valid case for php over Ruby or Python or Node, however as a CTO or a team lead, I'd really, really struggle to justify it, which pains me to say. If you're trying to hire php developers, you'll be hiring a lot of people who haven't changed how they work since the late 2000s. I'd rather hire code school graduates to write Ruby than a php developer with a decade of experience.
[1] People can write bad code anywhere, but pre-historic php is especially terrible. A company with bad golang is an order of magnitude more penetrable than a company with bad php.
I think the main cause is the low barrier for entry. It's great that anyone can get started quickly and be successful but it also means that the resulting mess can be at a level that you rarely see in other stacks where the barrier for entry is a bit higher.
I can clearly see that the PHP ecosystem is there (mature libraries for mocks, tests, etc) but like you said, there are people that just don't care. The language and ecosystem evolved faster than a big chunk of the developer community and I don't think everybody will catch-up anytime soon, as old PHP code bases can still generate a nice revenue doing maintenance.
The value proposition *is* the ecosystem. Do I prefer coding Python to PHP? Sure (although it's not night and day difference by any stretch of imagination). Do I prefer Laravel or Django? Laravel. Do I prefer WordPress or ....? Actually, there's no equivalent, it's the one ton gorilla in that space.
When it comes to the 'classical' web (but also fun new toys like Laravel Livewire), there's very little that can compete with PHP as far as I'm concerned and the IMHO minor warts are certainly not worth losing the ecosystem for.
Ease? I have not professionally used php since php4, and last set it up in php5.x.
Last night I wanted to send some data to an http server, a small payload of json, that would be saved into a DB and queried later. Took me all of 5m to realise that my php test script that receives the file can be copied over to my el-cheapo webhost account unchanged and work fine.
No extra "database" modules to download, then install on a host I've no shell access to, sending email worked out the box, etc.
Php reduces the friction. I remember trying to use Python for something (with Django, I think) in 2011 and it was absolute hell to get deployed onto my webhost; fingers burned, I won't touch it again.
Php is basically batteries included, and works everywhere. I'm sure the Python, Node or Ruby alternatives are elegant, and neat, etc ... but if I wanted that, it means the project is expected to be large-ish, and for anything more than a few thousand lines of code I'm switching to a compiled language.
PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course.
That, and also the fact that it may be pretty much the only dynamic language in use today with ARC and not a GC. Funny how PHP devs are often unaware of this.
Anyway I wish the language at least evolved faster and we wouldn't wait for 8.0 to have global `const` definitions instead of the archaic `define()` for example.
Careful there :-) Modern javascript has semicolons and is introducing pretty horrendous syntax for private variables (an octothorpe) and possibly for the pipe operator (percent sign, was it?) and for tuples and records, yet is showing no signs of dying.
function go() {
return
5 + 3;
}
console.log(go())
Since semicolons are optional, it's treating "return" as its own statement and "5 + 3" as a separate one.There are no hidden gotchas like this in PHP though since semicolons are always used:
function go() {
return
5 + 3;
}
var_dump(go());
This will return int(8).Not nowadays, for sure. In 2009-2010 it was still something to keep in mind, and careful array handling was common so the it wouldn't baloon hundreds of megabytes for not so large data structures. I wasn't working on big data (tm) at that time, but running database imports via ETL processes in PHP required a few optimization passes.
I really can appreciate nowadays the huge memory and performance improvements that PHP went through from the 5.x days to the recent 8.1 release.
Sidenote: Shout outs to Nikita Popov who came to the scene and revitalized the language for me back then, for his proposals and features implemented in a time when PHP felt stagnant language wise https://www.npopov.com/aboutMe.html#accepted-php-proposals
I don't see that as its biggest killer feature. In fact most projects built on PHP using a framework won't use the feature, as every request will be routed through a front controller. This has been true for at least a decade.
I think the killer feature of PHP is its shared-nothing architecture, tear-down at every request (or every x requests if you're using php-fpm) which has proved remarkably successful as it is so resilient.
I see the same pain for some next.js devs these days, even though it does allow parameters in roues in [name].js file form, I saw some people generating routers from file trees and finding it an acceptable compromise. Well, each to their own, I guess.
I agree. Shared nothing is definitely the killer feature.
Even if php-fpm is tear down at every x requests, each request still starts afresh in which each needed PHP file is required and loaded again. This is not slow because of opcode caching means that parsing etc. does not need to be done afresh. PHP just pulls from the opcode cache. At the end of the request the request is torn down. The interpreter instance might be reused again for performance (though that may be torn down every x request also as you implied with php-fpm for instance).
When you want to find out why something did not work in PHP you just need to go back to the start of the request and work your way from here. With a stateful system like Django (Python) or nodejs (JavaScript) you need to worry about the state of the full server in addition to what happen in a specific request.
This is an ideal model of course because large PHP implementations uses caching (in things like redis) to speed things up and the cached state could be the one introducing a bug. However, in practice, PHP tries to put in most of the state in a relational db so debugging a PHP script is much simpler due to this shared nothing feature.
> Every web request starts from a completely blank slate. Its namespace and globals are uninitialized, except for the standard globals, functions and classes that provide primitive functionality and life support. By starting each request from a known state, we get a kind of organic fault isolation; if request t encounters a software defect and fails, this bug does not directly interfere with the execution of subsequent request t+1.
> An individual web request runs in a single PHP thread. This seems at first like a silly limitation. But since your program executes in the context of a web server, we have a natural source of concurrency available: web requests. Asynchronously curl’ing to localhost (or even another web server) provides a shared-nothing, copy-in/copy-out way of exploiting parallelism. In practice, this is safer and more resilient to error than the locks-and-shared-state approach that most other general-purpose languages provide.
No. While PHP won't be the language of choice for academia or some new hipster startup that wants to woo junior engineers with the promise of "we're using the latest cool shit", the trio of PHP, Java and .NET with their associated ecosystems has managed the fine balance of evolution speed between uprooting everything on the regular (like NodeJS which went through at least three major build toolings with zero compatibility and the Javascript language itself with at least four ways of creating modules) and becoming a live fossil (like Perl) pretty well.
For PHP, just look at the Drupal, Joomla and Wordpress codebases to see how many ways there are to include files. For a current example, see the hate Laravel receives on how it does DI from Symfony-likers. There's also the Laminas (Zen) crowd going all-Java.
If something is popular, there WILL be many ways to do the same thing. Look at how Python is evolving.
Personally, in my career I've seen and worked with projects in SAP, Java (Tomcat), .NET, PHP and various JS-based projects - of all these, the JS projects had the most variety of bullshit (although SAP still gets the cake for "stuff I'll never willingly work with again" simply because how mind-boggling the entire environment is).
At least it's easy enough to get a bunch of Java developers to agree on what package manager and build tool they will be using - it will mostly be Maven and that's it.
For a nodejs project, you will first have to decide on the framework to choose, then on the build tool because not every framework works with every build tool, then you will lose a lot of time until Webpack finally does what you want, and in a year half the libraries you use will be unsupported.
https://www.php.net/manual/en/features.gc.php
> This section explains the merits of the new Garbage Collection (also known as GC) mechanism that is part of PHP 5.3.
> First of all, the whole reason for implementing the garbage collection mechanism is to reduce memory usage by cleaning up circular-referenced variables as soon as the prerequisites are fulfilled. In PHP's implementation, this happens as soon as the root-buffer is full, or when the function gc_collect_cycles() is called. In the graph below, we display the memory usage of the script below, in both PHP 5.2 and PHP 5.3, excluding the base memory that PHP itself uses when starting up.
ARC is more performant but can introduce memory leaks via circular references, which is probably not a big problem for short-lived scripts anyway.
Yes, PHP has reference counting, but it also has specific process that kicks in to clean up circular references.
Whole class of problems around multi-threading, mutexes, dead locks etc. are really foreign to PHP developers.
Perl uses ARC with no tracing GC, so you have to handle cycles yourself: https://www.perlmonks.org/?node_id=1173079
TCL uses ARC, and apparently doesn't need a tracing GC because it is impossible to create cycles in it: https://wiki.tcl-lang.org/page/Garbage+collection
Python uses RC, with GC available but only used for cycles.
They also share the same resources, so even your little blog can take as much (or more) traffic than your production application.
For Symfony: https://github.com/k911/swoole-bundle
For Laravel: https://laravel.com/docs/8.x/octane
I believe you can have fpm listen on TCP and run nginx in another container if you want, although I haven't tried it so I can't vouch for it.
Is that still a thing in PHP world? I recently ended up working on a 'modern' PHP project using Laravel and it was all routers and views and models and auto-generated scaffolding code, just like Rails and Django. There was no sign left of that 'old' approach.
I'm of the strong opinion that modern PHP with frameworks and auto-include and a ton of modelling is the wrong way to do it, but everyone else can do it that way, and I can still do things the old way and I can be happy.
PHP has this amazingly zen model of computing. At the end of the request, everything is thrown away to start fresh. This means anything you don't output is garbage. I don't think it makes a lot of sense to make sculptural models of your data and page structure only to throw them away. It's best to keep things simple.
There's some times and places where it makes sense to use more features, but starting with a kitchen sink framework makes it very hard to get simple where it's needed, but you can always pull in a little bit of something more complex into a simple thing.
Over Django: - Because if not doing SPAs, it provides infinitely better tools for the frontend, such as an integrated assets pipeline, a good template language with componetisation support - Because it is faster - Because during development every change is not a restart - Because it has an integrated queue system - Because you have popular frontend solutions such as Livewire
The only better thing I've found in Django is the admin.
Over Rails: - Because it is faster - Because PHP is far, far, far more popular tan Ruby - Because it has integrated authentication - Because it is easier to hire for
just some reasons from the top of my mind. I don't have a ton of experience with Rails and I think it is still great, but IMHO Laravel is better. I have worked with Django for about 10 years, and other than the Admin, I don't miss anything when working with Laravel. Language wise PHP vs Python is just syntax, I don't care as both ecosystems are pretty healthy.
Then came along templating engines like Smarty, and they introduced a new templating language for a language that was already built for templating. For some reason, "<?= $foo ?>" was considered much worse than "{$foo}".
A stigma that remains to this day, even though the spec is very clear about those kinds of short tags and the flags that affect them. PHP developers are absolutely terrified that some imaginary environment flag they have control over is going to brick their application, but are happy to bring in an entirely new templating language as a dependency instead. I'm sure Smarty was borne of a need, but I was never sure what it brought to the table except different tags for existing features.
smarty.net has a pamphlet up there where pros/cons (but actually only pros) are discussed [1]. Failing to understand that "<?php ...>" syntax is a SGML processing instruction with well-defined ways to embed into a hosting markup language like HTML, they go even so far as to say
> Another issue with PHP tags is that they share the <> characters of HTML tags. In the application code this isn't an issue, but mixed with HTML, <?php ?> tags are a maddening process to tell them apart from the HTML tags. This also blurs the line between application and presentation separation since any PHP logic can be injected into a template.
Yeah no, now you need new escaping syntax if you ever wanted to have verbatim {$whatever} in your HTML.
Notably missing is a discussion about HTML-aware, injection-free templating such as for preventing {$bla} expanding into <script>alert('Pwnd')</script> when sourced from user input, which is what SGML and other HTML-aware template engines can do, and which in the name of everything that's holy should've been implemented in PHP 2 to save the web from becoming a botnet.
Hack did this correctly with XHP templating. Unfortunately, Hack was killed by PHP7, and of all the features it took from Hack, context-aware native templating was not among them.
Then they tell learning CS theory is not required.
Naturally there are agreed names for other GC's, that is what widely acknowledged books in CS like "The Garbage Collection Handbook" [0], or papers like "A unified theory of garbage collection" [1] go about describing.
[0] - https://gchandbook.org/
And even if they do, what then? It’ll just be feature parity, so there’s no need to switch back either way.
I had to learn JEE(JSP,JSF,CDi,JPA) for some project lately, so now I understand a bit more why Doctrine, Synfony and co are the way they are, coming from Go, Ruby, Python and JS... Well I prefer just writing some JEE stuff rather than using a PHP framework in that case, because I realized the Java cargo culting was just insane in the PHP community and how PHP is poorly equipped to replicate that JEE stack...
PHP isn't going away though, billions of PHP scripts out there to maintain, and CMS are built in PHP mostly because of hosting providers still defaulting to Apache servers because cost.
Nothing is too little too late though, when I read about the evolution of Java, I realize I'm lucky to suffer through it today rather than 15 years ago...
> Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course.
JSP on Tomcat works mostly the same way. and nothing prevents anybody from using python or ruby, (or C++) in FastCGI mode. PHP has that whole "templating stuff" though.
That might be underestimating the feature, it was very much the core proposition of the language and likely why it's so well suited for web applications.
Python and Perl use reference counting too. Ruby, Lua and JS (at least v8) are GC'd. PHP isn't unique in that regard.
I love to focus my energy on building a great frontend with React or Vue.
And really, it's not a bad trade - financially. But it will frustrate your eng team, for a bit - especially if you don't actually get the revenue stream going.
I have one project with a dozen users that handles around 50 reads per second and maybe 30 writes per day, no issues at all. Setting up a DB for that would just bite the next dev in the behind since it would need a lot more maintenance then an apache server with php.
1. Low barrier to entry;
2. Hard to leak resources since the model is to tear down everything after a request finishes;
3. Stateless API core which means the efforts of creating an environment for a request for (2) is extremely low. Compare this to, say, the bootstrap time for Python or Java (which is why those generally don't follow the request teardown model);
4. Almost no multithreading.
This makes it great for servicing HTTP requests IMHO.
I need to compare it to Hack/HHVM though since I used that for years and it's still playing catch up with features Hack has had for years eg:
1. Hack has had the async-await model for years;
2. The type system is actually really good. It made me appreciate how nullability being part of the type system is incredibly useful. Plus it's had generics for years; and
3. Better inbuilt collection types with less odd coercion behaviour (ie dict, keyset, vec).
I find PHP hate in 2022 to be tired. Look at something like Laravel and PHP is completely fine. The sins of the past and even the odd inconsistencies still left in the language (eg needle and haystack param ordering) don't really matter.
The bootstrap time for a request exists only in a web framework, not in the language. And since you can have the extremes of pure fastcgi or uwsgi, or full Django, you need a more specific comparison.
Having used Laravel I did feel that was the best version of PHP I had ever used, which while great, each time I use it, I still feel encumbered. It could just be the workflows that PHP provides don’t/haven’t meshed well with the type of endeavors I’ve tried to approach. Or maybe the language just carries too much history.
As an undergrad I made the mistake of attempting to use php solve some bioinformatics homework and ended up reimplementing the k-means algorithm. While that example may be more revealing of my ineptitude for data science it broaches the topic of “where does a language provide the right primitives for the work at hand?” And if the web is changing, is it still appropriate to use a language designed around a previous version of the web?
It is weird than an article like this shows nothing for ctrl+f "hack"
I was mainly solving high performance parallel processing and distributed problems.
There are things like ReactPHP which are an awesome achievement, but still every lib you use needs to be developed for ReactPHP.
After learning about go and goroutines I only find it painful to solve these problems in PHP, even using ReactPHP.
My bad, because it took me a lot of time. I needed to do benchmarks were actually PHP turned out to have comparable performance in the scenario under test (concurrent consuming of message Queues and heavily write operations to databases), however it took more than 4 times the effort to get there with php.
In the end I resigned and switched to a new opportunity doing golang solving similar issues.
My point is, that there are folks out there (ab)using PHP for all and everything. And finally php has made a lot of improvements but it is just catching up with other languages. There are still a lot of libraries, that still use older versions and probably never will get updated.
Plus you can build just about anything with Go! Whereas PHP is pretty strictly for web development.
I've done some fairly big stuff, in PHP.
Works a treat. Fast, solid, secure. Widely-supported, great way to have a high "bus factor," because so many people can understand it.
All that said, I never did really like the language. It has always been a necessary evil, for me.
this way you can do async and build websocket servers and such and build http applications with event loop and without apache/nginx and such. etc etc
Modern websites in big companies require pretty complex backends that require data processing queues and other background activities. Can PHP compete with languages such as Go, Python or Ruby in the future?
These 3 languages are pretty comparable in many ways.
I'd say that something like MediaWiki, Wordpress or Drupal exceeds the definition of "simple backend".
Personally, I even tend to write shell scripts in PHP simply because the language is far more sane than Bash (and god forbid naked old sh) and I don't have to fight whitespace with Python.
No. I expect no seriously large projects are started in PHP anymore.
PHP is primarily used for web development, yes. That doesn't preclude it from offline processing, however. It's quite nice for quick file processing scripts.
Modern websites do not necessarily require complex backends. It depends on the site and its purpose. A minimal static site is just as modern as an ecommerce behemoth. Or are you using "modern" as a synonym for "complex?"
PHP can compete with languages such as Go, Python, or Ruby in the right circumstances. PHP has a vibrant ecosystem that Go cannot (yet?) match. It has a different feel that may appeal to people that dislike Python's syntax. It can also compare quite well with Ruby, though Ruby on Rails and PHP on Laravel are almost similar enough to make that contest a wash.
* Interoperability with the rest of our ecosystem, including the web platform: We could share code and install modules in all projects
* Availability of packages: For lots of common use cases, there are high-quality libraries available, such as process forking, socket communication, or message queues
* Easy to go from PoC to production: Start out with no-brainer arrays, then move to typed data structures easily
I find all the syntax critique on PHP to be completely irrelevant. It's a high-performance, dynamically typed scripting language. I can build the same things in it as with Go, Python or TypeScript, but the ecosystem is stable, tweaking it for production is easy, and it goes from "shoddy hackathon script" to "fully typed, production-grade application" smoothly. There's a single, pretty great package manager; type checking, although limited, works at runtime; code doesn't need to be compiled prior to running. All this makes it a good choice even for big projects to me.
What's really great about PHP these days is the development environment. Composer is a rock-solid package manager. Most frameworks and important libraries are gravitating toward shared standards defined by PSRs. Thanks to those shared standards, the APIs are stable and easy to understand. There's no colors/faker/left-pad drama. Everything just works out of the box and keeps on working. Everything is extensively documented. And somehow the runtime keeps getting faster without breaking backward compatibility.
Yet. Composer packages have the same attack surface as NPM packages, the only thing that is different is that there are (outside of frameworks like Drupal and Symfony) no automated post-install scripts that get executed during a "composer install".
The fundamental difference is that lots of what is popular in the NPM world isn't needed in the Composer world at all due to PHP's extensive stdlib (meaning, less people having to maintain trivialities like left-pad and thus less potential for people to get hacked/sell out/get burned out in frustration).
Furthermore, most highly popular PHP projects have extensive corporate, consulting or foundational backing - Symfony, Drupal, PHPUnit, Laravel, Typo3, MediaWiki, Wordpress to name the biggest players - and each of these provides to developers what the stdlib is missing, so there are strict QA and release procedures to prevent a repeat of the current colors/faker events.
TBH, I don't think PHP is going in that direction.
This was one of my requests to that new search engine posted here a few days ago.. Filter on minimum version of technology. Should actually just be a field in stackexchange.. packages/languages references + version. And a marker to set if the information is obsolete.
You can't get rid of old stuff in the name of BC, but you often simply don't have to use that old stuff. For example, people hate on JavaScript (and PHP too I believe) for the semantics of their "==" operator, but it's a moot point since these languages have had "===" since many years.
Every beginner knows that because all recent books literally say "don't use ==, use ===", modern IDEs will point it out for you and 1st code review feedback will point it out.
What usage of this moot point showcases for me is mostly author's blind bashing without real knowledge.
Many languages are unityped and carry the same problems, yet they are hyped rather than bashed (e.g. Python, Ruby).
> If you know why you shouldn't use `==`, you know enough so that even if you don't go for `===`, using `==` safely is the least of your problems.
You have some weird false dichotomy going on. I'm personally in the state "I remember why == is bad (type coercion ...)" but I don't remember all the details to be able to use == correctly. I bet many people are in a similar situation.
You can, it just takes ages and dedication and will cause a lot of friction. See: Python's changes between 2.x and 3.x, .NET's breaking changes between 1.x and 2.x+
Of course Taylor and the Laravel team have paid products, but they are all 100% focused on the Laravel ecosystem and developer experience!
Some of the things that the Laravel ecosystem has as first party packages / services:
Paid:
• Vapor - Serverless Platform. Run your vanilla Laravel apps on Lambda.
• Forge - Server Management. Builds Laravel ready servers on any cloud.
• Envoyer - Zero Downtime Deployment. Deploy your apps with push-to-deploy.
• Nova - Administration Panel. Completely code-driven admin panels.
• Spark - SaaS App Scaffolding. Basically a SaaS starter kit.
Free:
• Horizon - Queue Monitoring. Like Sidekiq
• Jetstream - App Scaffolding. SaaS starter kit with teams, invitations, api, etc.
• Echo - Realtime Events. Think Pusher, Socket.io, etc.
• Sail - Local Docker environment.
• Valet - Dev Environment for Macs.
• Mix - Webpack Asset Compilation. A sane wrapper around webpack.
• Cashier - Subscription Billing Integration. Stripe + Paddle.
• Dusk - Browser Testing and Automation. First party browser automation for tests.
• Sanctum - API / Mobile Authentication.
• Laravel Scout - Full-Text Search. Wrapper around Algolia, Melisearch, or full-text database searching
• Socialite - OAuth Authentication. Log in with GitHub, Google, etc. Dozens of community packages as well.
• Telescope - Debug Assistant.
That's all first party. It's unbelievable to me how many batteries are included. Then you start looking at the surrounding ecosystem beyond that and it gets even crazier.
Laravel as a community is an extremely welcoming place, and I have found that most people care deeply about their code and architecture, but don't pick each other to death on details that don't matter. I think all in all it's a pretty pragmatic group.
If you haven't checked out PHP lately because you think we're writing a file-per-page and FTPing them up somewhere, you should give Laravel a look.
I mean, he took the most popular, but somewhat 'not cool anymore' backend programming language with a huge pool of developers, and proceeded to build _the_ way to build server applications with it. If that's not strategic brilliance, I don't know what is.
EDIT: For context. My exposure to Laravel is jumping into some projects and becoming productive in a day without prior exposure to PHP. Largely due to superb documentation and the batteries included approach.
That would be amazing. I agree, I think Taylor has good vision. His overriding principle seems to be "make people's lives easier," which makes for a pretty good ecosystem.
Some of these are definitely given more love than others, of course. I'd probably pay for some extended 'dusk' package to provide a better experience overall, but... unsure there's enough of a market to justify that?
I recently learned that the 'envoy' stuff is already free in Laravel - envoyer seems to be a hosted SaaS built with it, but you can define your own 'envoy' stuff to run however you want. https://laravel.com/docs/8.x/envoy
- Pattern matching in switch statements (done horribly wrong)
- If, while, and switch expressions
- Inferred type system
- Consistent array method argument order
- Actually usable higher order functions and reflection
Big reminder: Php is a fractal of bad design, and I intensely hated using it at work for many years. The only good thing in Php is Symfony2 framework. - Pattern matching in switch statements
- If, while, and switch expressions
- Inferred type system
- Consistent array method argument order
- Actually usable higher order functions and reflection
?Nowadays, it seems to mimic Java, while having inferior libraries, I'm not sure what's the advantage.
I strongly believe that a programming language should be stable over a longer period of time while bug fixes and behind the scene improvements are fine, but for the developer it should not be a moving target, the manual should not triple in size and developers that know very well version x-1 should have zero problems with version x. There is a huge cost of change and if some people don't care, real life does.
ReasonML or ReScript is what JS should have been since day 1.
Easy adoption for all levels of programmers is what make it work for enterprise applications now.
I'm more on the strong-typed side of life nowadays. But otherwise I think it is a good choice. Also: HTML could be expressed in scheme as well. Scheme all the way down.
For most cases it's enough to just define interfaces, enums and maybe bundle some of this into discriminated unions. Throw in some generics for good measure. That's not a lot of work.
I've seen people do stuff like dependent types, but unless you're writing a library you don't actually need most of the type system's features.
In my opinion, all the modern 'script' languages are now adding static-typing one way or another, to make they much robust(python's mypy, typescript,PHP, etc).
I will pick PHP for backend website development, I just want to avoid the async-node-js as much as I can as it's much worse than other options I feel.
Can you give a reason why we should not have them?
I see PHP continues to import all of the problem of npm into the PHP community, I moved away from php about the time packagist started to gain ground.
1. NPM has a global namespace that was shoe-horned into an organization thing later. Packagist has been namespaced since day one. Using a namespace avoids almost all of typo-squatting issues etc.
2. NPM hosts the code at its end. This means you could review some code on GitHub and it might not match the code that you get. Packagist fetches the code from GitHub (same guarantees as Go)
3. NPM: The package version is defined _inside_ the package.json file. This causes issues, because the NPM registry is not necessarily the source of truth for this data, resulting in weird edge cases, such as this bug[0]. Composer/Packagist on the other hand just syncs tags against GitHub.
4. The whole NPM ecosystem needs a whole lot of additional tooling to actually publish packages on NPM. NPM doesn't support robot accounts (PATs are not bots), so you must provide a token with complete write access to your account to your CI system, which then must build and push a package to NPM. This process being without 2FA has led to a lot of compromises. Every release also needs chores to bump the version in package.json (which doesn't have to match the version in package-lock.json). Packagist side-steps all these issues by setting a webhook on your repo (no write access needed) that can trigger a sync on Packagist end. Ideally, this should just work with an RSS feed, but webhooks are easier to build.
NPM has a lot of good ideas (ability to load multiple versions of the same package for eg), but Packagist isn't a terrible package manager - it works quite well, and you rarely see people tripping over composer like how happens with the Python ecosystem. The PHP community also prefers medium sized packages, so you don't get a thousand dependencies accidentally.
[0]: https://github.blog/2021-11-15-githubs-commitment-to-npm-eco...
I think it was Laravel or Lumen? I tried that one once and was kinda amazed it pulled like 100 packages. In PHP ecosystem, I think that's considered a lot (to be fair, this is few years back). I've worked on fairly large projects (mostly Symfony + Doctrine and PHPUnit) and don't recall seeing so many dependencies.
Now compare this to initialization of any common JS framework starter.
The PHP ecosystem tends to use packages-for-interfaces, so that ups the count somewhat.
The point is that Composer packages are far from being that granular, we have less dependencies by literally order of magnitude.
laravel/framework:
no-dev-deps: 307,405 lines of PHP (36MB)
all-deps: 535,383 lines of PHP (58MB)
react (stock create-react-app)[1] all-deps: 1,570,720 lines of Javascript + 96417 lines of typescript (348MB)
rails (rails new app): (no-dev-deps): 264123 lines of Ruby + 23614 lines of C + 17009 lines of JS (55MB)
(all-deps): 332083 lines of Ruby + 23614 lines of C + 18055 lines of JS (54MB)
Here's the raw results: https://www.toptal.com/developers/hastebin/osujizeraw.txt[1]: create-react-app doesn't split out dev/prod dependencies https://stackoverflow.com/a/44872787/368328
[0]: https://insights.stackoverflow.com/survey/2021#technology-mo...
I could argue 100% of the 40% of the people actually uses PHP and 100% of the 60% people don't even use it.
> Which programming, scripting, and markup languages have you done extensive development work in over the past year, and which do you want to work in over the next year? (If you both worked with the language and want to continue to do so, please check both boxes in that row.)
Of course nothing requires survey participants to be honest or to actually totally read and comprehend the question.
A lot of frustration with PHP comes from using it a lot (not ignorant) and not enjoying it. They want to be better programmers than they language would allow.
Granted, PHP has improved a lot since I last used it (2004). I think a lot of the arguments were true, but are no longer valid.
I also suspect a lot of the people complaining about X language/platform/ecosystem are not even using them in production environments judging by their very idealized view on building software.
All of them?
Example: Someone saw some bad PHP code once in their lives and think all PHP code is bad. They saw someone say bad things about PHP so they think all PHP is bad. Or they think PHP is bad because they don't like how it looks.