5 ms·
Having been in the C# world for a long time, and the various web/api frameworks. PHP is really nice if you dig into it, it includes so many great functions an
by ThinkBeat 1y ago
Having been in the C# world for a long time, and the various web/api frameworks.
PHP is really nice if you dig into it, it includes so many great
functions and functionality built in for creating web stuff.
It also has a number of issues,. but to quikly put something together
PHP take the win in my limited opnion.
- reactordev 1y agoThe only reason PHP still exists is because of shared hosting companies and Wordpress. PHP’s initial appeal was you could do scripting on the server side, “turn off PHP with a ?>” spit out normal html, and “turn back on PHP with a <?php”. For a beginner programmer, it was simple, easy to understand, and had an include so your designs were’t nested table hairball messes of garbage. (but your CSS was definitely garbage). Today, it’s so easy to run JavaScript, I can build a basic jsx site in under an hour, just like I can with PHP and includes. With Bun, I can quickly write a data access layer as well and wire up crud APIs w/ JWT auth. A weekend project in both.
- hnlmorg 1y agoPHP might have a bad reputation but I honestly don’t think JavaScript is a better language in real world terms. I do get why JS appeals to people, but switching from PHP to JS feels a little winning an internet argument — you might feel smarter for doing so but in reality all you’ve done is sunk time into something that doesn’t make you any better off.
- austhrow743 1y agoWhat if the context isn't that you're switching from PHP though? What if the choice is to stick with Javascript for the full stack, or to also learn PHP on top of Javascript?
- tialaramex 1y agoThere's a firm foundation in Javascript. The choices aren't choices I'd make but they're choices I understand. Brendan Eich knew what he was doing and it shows, indeed if it was made simply of bailing wire and string it'd have been replaced. For PHP on the other hand - even when I started writing PHP3 - so certainly not the very beginnings, it's clearly just cobbling together whatever works from unrelated half-understood parts and so there's no coherent centre to it, when I last worked on some PHP earlier this year it still felt like bailing wire and string.
- hnlmorg 1y agoThe JavaScript invented by Eich is nothing like the clusterfuck that is the modern JavaScript ecosystem. And modern node.js code will look nothing like the JavaScript Eich developed for Mozilla. Equally, PHP3 is worlds apart from modern PHP. Your point is a little like saying “motorbikes are easy to maintain because they’re based on the penny-farthing”. Times have changed and your references are literally decades out-of-date.
- zelphirkalt 1y agoDo we need to post that JS' weird things link here? Of the basics of JS, few things are sound. The "firm foundation" idea doesn't really work for JS. It might even work better for PHP, and I am saying that as someone, who doesn't want to do PHP ever again.
- com2kid 1y agoJS is very much a minimal language that has a handful of choices. E.g. arrays being objects with field names that are sequentially numbered integers. The initial equality operator was a mistake, but that was rectified over a decade ago with `===`. Not having a proper int type sucks and holds the language back in a number of ways, but otherwise the language is wonderfully regular. And anyone who complains about the ecosystem has obviously never tried python, which after a decade of attempts, is now almost on par with JS of a decade ago!
- hnlmorg 1y agoYou shouldn’t compare backwards. Saying “at least x isn’t as bad as y” doesn’t further a discussion, it only acknowledges denial about just how bad the problems are with x. This is particularly true when we weren’t even discussing y (in our case, Python) in the first place.
- phplovesong 1y agoJS is basically just a comp target as of 2025. If PHP devs used something like Haxe they would be amazed how safe their programs would be. But i usually just see slop instead.
- freedomben 1y agoI'm not a huge fan of PHP, but for simple sites I think you way underestimate the power and simplicity. It feels old compared to jsx approach, but old doesn't always mean bad. I've increasingly returned to the template rendering model pioneered by PHP and for sites that aren't full blown apps, it is a lot simpler which means faster iteration and reduced cognitive load. I think you really have to decide based on the complexity you need
- sublinear 1y ago> I think you really have to decide based on the complexity you need I don't really agree. I think the goal should be to reduce complexity where possible, but not if you're inevitably painting yourself into a corner. If you want the simplest and most scalable way forward, write static pages and avoid server-side rendering.
- zelphirkalt 1y agoHow would you be painting yourself into a corner with PHP more than with JS? If you use PHP, you can just serve/use JS later. But if you use JS, you will have a hard time serving HTML from PHP later. Aside from both languages kinda being painting oneself into a corner, I don't see how one would do more so with PHP than with JS, out of all the things.
- sublinear 1y agoI'm coming from the perspective of real world business concerns, not hobby projects. It's inevitable that you will need to host the pages somewhere else like a CDN to lower latency, integrate with other backends, and the biggest one is allowing the frontend devs to have complete control of the HTML so that stylesheets and javascript don't randomly break for reasons out of their control. They should be able to develop everything locally with mocks instead of your server and use whatever build tools and frameworks they want. There are also SEO and accessibility concerns with the page structure. The backend devs should not be making decisions about any of that. Sometimes the client may want quick turnaround on simple but very specific changes to the pages. None of that process should depend on backend teams who don't care and will drag ass about it because they will have to refactor their junky code that hasn't been touched in years. Getting rid of dependencies and having good boundaries in the code that align with the way dev teams are organized is always a good thing. I'm not sure why anyone would go for SSR unless they haven't done web dev in a while or are working on a legacy project. Even if this starts out as a hobby project, you need to keep things clean for future maintainers.
- monooso 1y ago> The only reason PHP still exists is because of shared hosting companies and Wordpress. Unfortunately I can't think of anything constructive to say about this nonsense. > Today, it’s so easy to run JavaScript, I can build a basic jsx site in under an hour, just like I can with PHP and includes. You assume people agree that it's preferable to work in JavaScript.
- k_roy 1y agoAnd still nobody outside of Meta cares about hack. The niche I think PHP had back in the day has largely been supplanted by Python. Maybe it’s better now, but after moving on from it to basically anything else after a 25 year career, I don’t miss it.
- monooso 1y agoI'm not sure what point you're trying to make by mentioning Hack. At this point it's diverged from PHP to the point that it's basically a different language, is (IIRC) actually slower than PHP 8, and the HHVM doesn't even support PHP any more. As such, it's not a huge surprise that relatively few people outside of Meta give it much attention. I also moved on from PHP several years ago, and don't miss it. That doesn't mean I don't recognise that there are still perfectly legitimate reasons to choose it.
- k_roy 1y agoYep. And meta/hack is probably the other huge mainstay of PHP outside of what the person you responded to said. And hack with HHVM was supposed to be the panacea for PHP Just saying. What people used to use PHP for tasks, has largely been replaced by Python.
- timeon 1y ago> And still nobody outside of Meta cares about hack. Because everyone is OK with PHP. I'm not even using it directly but most of the web runs on it.
- const_cast 1y agoPHP has a much more competent type system than JS and is overall more ergonomic IMO. Typescript exists, but if I'm compiling something I'm using a real language or framework like dotnet. There's no reason for me to use typescript and node and install 100 packages when I can just install dotnet.
- reactordev 1y agoinstall dotnet, and install 100 packages for .net core, asp.net, identity, ef, etc. Don’t kid yourself. While strongly typed languages are great. I like to be able to get things done. This is why I don’t C++ anymore. This is also why I don’t dotnet anymore. Too much BS with the type system and correctness and the Microsoft way or lack of support or rug pull. They lost me when they killed XNA. Typescript is actually good, except for the fact that it’s a transpiler to JavaScript. That part sucks. I want a C++, with Types, with memory safety, with garbage collection, with pointers, with a dev experience like dotnet, but we don’t have those things.
- const_cast 1y agodotnet is a batteries included framework... It has way more included than any other language, including JS and PHP. > I want a C++, with Types, with memory safety, with garbage collection, with pointers, with a dev experience like dotnet, but we don’t have those things. Dotnet, you want dotnet. Dotnet has all of those. Yes it has pointers.
- mircerlancerous 1y agoCompletely agree. I don't work much in PHP anymore, but there's still nothing that's faster or easier to get something up and running. I use it for web services, and command line scripts when I just need something fast.
- DoctorOW 1y agoTo give an example, my main website is C#, I love it from a dev perspective and performance perspective. But I also have PHP on my personal server and will knock out PHP scripts for one off demo projects. I just ssh into my server, `vim projects/example.php` and it's instantly deployed as a link I can share.
- hu3 1y agoThere's `dotnet run` now. You can: vim projects/example.cs var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/", () => "Hello World!"); app.Run(); dotnet run projects/example.cs Not the same as PHP I know, but it's close enough for me.
- DoctorOW 1y agoI'm glad it works for you but I guess that doesn't really cover the use case I was talking about because I want to have a bunch of these. As an example, I threw together a quick web hook processor, data from one service reformatted to fit another. I don't really need to spin up a whole new VPS for an endpoint that'll only be hit once or twice a week, so this is the workflow for doing that on the server I already have. PHP: - vim projects/webhook.php C#: - vim projects/webhook.cs - Assign a port number - Reconfigure Nginx/Caddy to serve that port number - Reconfigure systemd to dotnet run projects/webhook.cs on startup