Live data from Hacker News

PHP in 2023

stitcher.io

81–90 of 285 posts

Re: PHP in 2023

#81
post #57

Earlier quoted context omitted.

What's the point? You can use types in the vast majority of places in PHP and it works well, so I don't really see the point of that instead of contributing to the native typing system.

Javascript already set the precedent. If you don't like the way a language works, it's preferable to have a proxy language that does work the way you want that compiles to it, rather than accept the language for what it is and learn to work with it.

what do you suggest to achieve this? electron?

Re: PHP in 2023

#82

If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building web applications. It's the greatest web framework to ever exists, even better than Rails IMHO. The ecosystem around Laravel is really incredible and unlike any other framework. They have libraries for every stage of a web application from taking payments all the…

Just to offer an alternate opinion for anyone reading -- check out Next.js

Re: PHP in 2023

#83
post #67
post #21

Earlier quoted context omitted.

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.

Maybe because there are already major programming languages at that level already, which arguably do things better: if you are going to have a Java-like OO model, then just use Java (and leverage its ecosystem, tooling etc). Whereas there is a niche for a quick-and-dirty scripting language for just getting something up and running.

... You can still hacky script in it, my dude. I have to do that several times a year for stuff like one-off ETL's for customer data, or to verify an idea before rewriting it properly..

Absolutely nothing about modern PHP stops you from writing like the crayon-muncher you were back in the early 2000's...

You just also have the option, to, you know, use battle tested libraries and work with cohesive community driven standards now as well.

Re: PHP in 2023

#84

Earlier quoted context omitted.

It is tidy and efficient. One question: Are you saying “docblocks?” I’ve never heard of this. Thanks!

Yeah, doc blocks. It's a name that originated within PHP a long time ago: https://docs.phpdoc.org/guide/guides/docblocks.html

Thanks. I haven’t used PHP since 2011 or so.

Re: PHP in 2023

#85

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…

> I used to work way back in the day on PHP too, This is your issue - PHP Modern PHP (with a framework like Laravel or Symfony) is probably one of the most productive ways to build web applications. > It's not beautifully well thought-out the way Python is. This is definitely an interesting take... Python hasn't even solved package management yet. And the 2.7 => 3 migration is probably the most famous example of maki…

[deleted]

Re: PHP in 2023

#86
post #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.

What is, in your opinion, the benefit of that over the "traditional" model of having a web server in front for static assets and fCGI/fpm as the link?

Re: PHP in 2023

#88

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…

> I used to work way back in the day on PHP too, This is your issue - PHP Modern PHP (with a framework like Laravel or Symfony) is probably one of the most productive ways to build web applications. > It's not beautifully well thought-out the way Python is. This is definitely an interesting take... Python hasn't even solved package management yet. And the 2.7 => 3 migration is probably the most famous example of maki…

I'm on PHP 8 and I feel the same as parent.

Sure, there's been a lot of progress since the PHP 5 days, but the core of the language has been left mostly untouched by design, and we haven't seen the kind of drastic moves like JS moving to ES6 syntax.

It's a matter of taste, so there's no absolutr truth. I hate PHP's function and property access syntax differenciation and wildly prefer ruby's approach or instance. And there's so much more nice things coming in languages that have been designed from the ground up to be nice to use.

I understand PHP's pragmatism, but can't find it pleasant to use TBH.

PS: we got arrow functions, but they stay limited to anonymous functions for instance...

Re: PHP in 2023

#89

Earlier quoted context omitted.

Those functions are all still there. You can still do if you like.

isn't doing too well

If you wanna hang your hat on that, go for it. The hacky approach the parent poster yearns for is still entirely possible, even if you have to update a half-dozen lines of mysql_connect to mysqli_connect.

Re: PHP in 2023

#90

Earlier quoted context omitted.

Those functions are all still there. You can still do if you like.

isn't doing too well

It's a pretty dumb argument to make on the basis that no functionality was lost (There is both the MySQLi extension, and the more general PDO one), and if you really, really can't get the budget to refactor it, you can drop a single shim file in to "get those functions back" while using either of the mentioned extensions to do the actual work.
Post reply on HN