Live data from Hacker News

PHP in 2023

stitcher.io

31–40 of 285 posts

Re: PHP in 2023

#31
post #5

I used PHP in my university days, 20 years ago, and went on to build a few websites with it that I still run today e.g. https://caption.me It was a fantastic student language - the docs were great, the code was simple and imperative, there was loads of prior art online. It was empowering to tweak code and see immediate results in the browser. These days I prefer the strictness and ecosystem of Scala on the back-end,…

If you are the sole developer working on migrating the project and you want to have the frontend in React.js why not use Node.js/TypeScript instead of Scala for the backend? This would save you from context switching between two languages and consequently increase the development speed. Also why the rewrite? If it works (in PHP) it works. Perhaps instead you could maybe add some frontend JS for better caption UI/UX?…

I tried Node.js on the backend but it didn't have the expressiveness and ecosystem of Scala.

I run a few simple Node and Python apps behind the scenes of caption.me, but for the core code, I want the power of Scala, its functional style, rich type system, monadic composition, immutability-by-default, avoidance of nulls etc. As well as great libraries like http4s, Doobie etc, Scala also gives me access to the entire Java ecosystem.

The PHP->Scala/ReactJS rewrite is partly a learning and experimentation project for me. I use Scala in my day job, and when I make technical/architectural decisions, I benefit a lot from the stuff I've learnt in my side projects, particularly on the front end side.

PHP has had its day in the sun (as shown in the job market trends on https://www.itjobswatch.co.uk/jobs/uk/php.do ), so I think it's more valuable to get exposure to modern languages as I still have a few years of professional coding ahead of me :-)

Re: PHP in 2023

#32
These days - I use swoole/openswoole with any PHP project. it brings connection pooling, async, concurrency, event loop, io parallelization and much much more.

Re: PHP in 2023

#35
post #21

Earlier quoted context omitted.

As of PHP 5, it lost its way and started imitating the Java OO model with a worse botched-on syntax. PHP 4 used to be a compact "hypertext preprocessor" with many built-in groups of functions, enabling you to process forms, talk to databases or process images without much code.

How has PHP lost its way? It grew up from a poorly thought out hacky scripting language to a major programming language. All the nasty code you could write in PHP 4 or 5 is still possible, but everyone will look at your code and laugh.

There are many other possible directions the language could have evolved in since then. For example, an emphasis on its dynamism and statelessness rather than introducing a static Java-like OO model for building hierarchies of classes. Or a modular system that encourages the user to put “complex” code in C modules, making application development as simple as calling a few functions.

Re: PHP in 2023

#36
I used to work way back in the day on PHP too, but even though I'm sure this will be downvoted, it's really sad people still take it seriously as a language in 2023. There's nothing remotely elegant about it. It's not expressive or programmatically succinct in the way Ruby is. It's not beautifully well thought-out the way Python is. It's not fast and modern in the way Rust is. It's not elegant or composable or client-side renderable in the way React.*script is. It just brings nothing to the table. It's an ugly hodgepodge borne out of an over-engineered homepage from 28 years ago. Various business interests have kept it afloat, and people who don't know any better keep championing it. I think people do eventually catch up with what's going on though as soon as they personally experience writing anything remotely serious (5-10,000+ LOC) that isn't a simplistic web-app.

Re: PHP in 2023

#38
post #20
post #3

used php in 2015, decided that it's not that nice. last couple of months, I've been banging my head with php7. granted, it's a legacy project, but it is still the same php 7-8 years ago.

If you're inherited a legacy project thats a mess then the chances are it was written by some ass who's not following the languages generally accepted PSR standards. Proper PHP code is extremely easy to dive into and maintain. The benefit and downside of the PSR standards is they are optional. Sadly some think they know better and opt to roll their own convoluted 'standards' that just end up creating hell for the nex…

PSR isn't generally accepted. It's a bunch of nobody know-it-alls that decided everyone needs to write java in PHP.

No thank you.

Re: PHP in 2023

#39
post #34

Why would a new project in 2023 choose PHP over anything else (modern Java, Kotlin, C#, etc.)?

The rich ecosystem, the amount of developers experienced with it, ease of deployment and maintenance
Post reply on HN