5 ms·
> In short, the modern PHP ecosystem gives us the best of both worlds: the ability to build quickly and confidently in PHP, while still having powerful options
by hu3 1y ago
> In short, the modern PHP ecosystem gives us the best of both worlds: the ability to build quickly and confidently in PHP, while still having powerful options (C, Rust, Go) for performance-critical parts. This hybrid approach lets us stay productive without sacrificing speed where it matters most.
I understand this for a large codebase where rewriting is not feasible.
But if that wasn't the case, a C# APIs achieves both speed of development and execution in my experience. You'll rarely need to reach for C++ or Rust.
PHP is great but the language still doesn't allow things like typed arrays. It will happily accept string in a array of dates, for example.
- honorary-hickup 1y ago> It will happily accept string in a array of dates, for example While completely true, you are using static analyzer anyway which won’t let you do this. The generics support will likely come in the near future, there has been momentum in it again: https://thephp.foundation/blog/2025/08/05/compile-generics/ https://thephp.foundation/blog/2025/08/05/compile-generics/
- s1mplicissimus 1y agoI'm working in PHP for about 15 years by now, and for about 10 of them I was promised generics. In favor of your health, don't hold your breath.
- ThinkBeat 1y agoHaving 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.
- 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
- jofla_net 1y ago>It will happily accept string in a array of dates, for example. Yeah theres a bunch of oddities that rear their head from time to time. I've had one peculiar JSON de-serialize bug lately that really threw me for a while. I normally do the json_decode() with the second arg set true, which yields an assoc arr. This doesn't tell the whole story though. IF the key is numeric when decoding, PHP will make its key an int! and not a string like the rest. I'm guessing it does the equivalent of an is_numeric() check or something. This yields an array with keys which could be ints and strings :/ Still for all its warts though it is a fantastically Frankenstein of a language!
- newuser94303 1y agoI would never use a Microsoft language since they discontinued VB6. Open Source languages are the only sane option.
- chairmansteve 1y agoC# is open source.
- mrsmrtss 1y agoAnd you are not using Typescript either, because it's a Microsoft language? Also .NET is open source over a decade already and c# was free and open from the beginning (Mono implementation).
- avan1 1y agoAuthor here. thanks for reading my post. actually you still don't need rewrite. running php with workers (swoole, frankenphp, ...) may be as fast as node. and for typed array php has static analysers like phpstan. it support generics and typed arrays with typed comments.