Live data from Hacker News

PHP 8: Before and After

stitcher.io

271–280 of 346 posts

Re: PHP 8: Before and After

#271

Earlier quoted context omitted.

> And the worst being the attribute #[] syntax... why?! Almost every other language uses @attribute, and it is successful: simple to write, easy to read, why on earth a new and such complicated solution? Simple, it was already taken up [1]. Also `@attribute` syntax is by no way universal (and semantics wildly vary even with the same syntax): `#[]` in particular might have been inspired by Rust. [1] https://www.php.ne…

The rfcs have a lot of discussion on those subjects indeed, but I still disagree with the choice! Also, the current use of @ is before a function call or some get, not before a method/class/... declaration, so a change in that direction would probably be possible. (plus the @ to suppress errors should probably be removed from the language anyway!)

It's not possible because PHP has a LALR(1) parser but this would require arbitrary lookahead.

Re: PHP 8: Before and After

#272
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

> this has an impact on performance

And yet, I find that PHP apps tend to be quite performant, compared to say Java or Rails (I don't know about node, maybe not compared to node). But I'm not a PHP developer, this is just my impression. And the complaints you hear about PHP, I seldom hear performance. No?

Re: PHP 8: Before and After

#273
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

What I miss about PHP is that it was possible to put a file in a folder and use it instantly.

If you want to quickly do something without diving into frameworks the tooling was easy to setup and rarely fell apart, if ever. There are not many moving parts, you usually have a web server that is very solid and comes with an installer that you hit next next next. Then you have a database server, usually MySQL. Sometimes you would need an extension to work with images, you put it in place by editing an .ini file.

Almost like an Excel for backend.

Re: PHP 8: Before and After

#274
post #267

Earlier quoted context omitted.

PHP apps following modern best practices usually include stateful middleware of some kind though, so this applies in theory more than in practice.

If you mean persistent databases or caching like Redis, it's still much easier to accidentally reference a global pointer due to a programming error than accidentally put something in a cache store. All systems need some sort of persistence, this is true for other languages as well.

No, I'm talking about the kind of thing that provides a `Context`-like object that allows the application developer to share memory between requests.

Re: PHP 8: Before and After

#275

Please remember that PHP is more or less the only truly free (as freedom) community driven language suitable for both prototyping/pet projects and enterprise grade web software development. TypeScript and C# are Microsoft, Go is Google, Java is Oracle. Python is not suitable for complex multi-layered systems, Rust is too young and let's see where it will go without Mozilla. Ruby? IMO Ruby is in sunset phase, no new a…

> Python is not suitable for complex multi-layered systems

But PHP is? I cannot imagine a "complex multi-layered system" for which PHP is a better solution than a Python stack.

Re: PHP 8: Before and After

#276
post #194

Please remember that PHP is more or less the only truly free (as freedom) community driven language suitable for both prototyping/pet projects and enterprise grade web software development. TypeScript and C# are Microsoft, Go is Google, Java is Oracle. Python is not suitable for complex multi-layered systems, Rust is too young and let's see where it will go without Mozilla. Ruby? IMO Ruby is in sunset phase, no new a…

Go isn't free? JS isn't free? Guile (which is probably as free as you can get) comes with a web framework too. Also what does "enterprise grade" mean? I'm not sure if you're aware but the forum we're talking on right now is written in PG's lisp dialect. I'm pretty sure arc is free.

Go will go where Google wants. If you are not Google, you have zero chance introducing substantial changes into it.

JS is not a programming language, it's some nonsense.

Re: PHP 8: Before and After

#277

Earlier quoted context omitted.

I am wondering this: are people who do crud apps (in php or otherwise) do consider race-conditions in the database? Like one query and then based on that query another one which inserts/updates? And if so, where can I read about the standard techniques used in practice?

Database transactions is the topic you should look into. There's ways to handle these in all environments. https://en.wikipedia.org/wiki/Database_transaction

Thanks. So is the general industry practice? I read MySql only supports this since like 2004, somehow reading material doesnt seem to be too concerned about these.

Re: PHP 8: Before and After

#278
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

> this has an impact on performance And yet, I find that PHP apps tend to be quite performant, compared to say Java or Rails (I don't know about node, maybe not compared to node). But I'm not a PHP developer, this is just my impression. And the complaints you hear about PHP, I seldom hear performance. No?

if you do something in a naive way, PHP performance can tank pretty severe - but that's more down to the developer implementation rather than a shortcoming of the language itself

Re: PHP 8: Before and After

#279
post #267

Earlier quoted context omitted.

If you mean persistent databases or caching like Redis, it's still much easier to accidentally reference a global pointer due to a programming error than accidentally put something in a cache store. All systems need some sort of persistence, this is true for other languages as well.

No, I'm talking about the kind of thing that provides a `Context`-like object that allows the application developer to share memory between requests.

that's not really a thing you do in PHP, outside of frameworks like swoole/roadrunner. by nature it's a fire/execute/die shared-nothing model

Re: PHP 8: Before and After

#280

Please remember that PHP is more or less the only truly free (as freedom) community driven language suitable for both prototyping/pet projects and enterprise grade web software development. TypeScript and C# are Microsoft, Go is Google, Java is Oracle. Python is not suitable for complex multi-layered systems, Rust is too young and let's see where it will go without Mozilla. Ruby? IMO Ruby is in sunset phase, no new a…

> Python is not suitable for complex multi-layered systems But PHP is? I cannot imagine a "complex multi-layered system" for which PHP is a better solution than a Python stack.

PHP has (almost) complete strong typing system and all the bells and whistles of OOP needed to implement said systems using proper patterns and methodologies and make it modular and testable enough to be robust and supportable for a long time.
Post reply on HN