Live data from Hacker News

PHP 8.4

php.net

41–50 of 337 posts

Re: PHP 8.4

#41

I have a question to the PHP-in-production crowd: how long do you wait before migrating to higher version of PHP? Is the first release usually already fine, or is it better to wait for a few months and let someone else catch the early errors?

We start making sure our application runs on the next version around the time Beta 1 comes out.

We upgrade the development environment around the time when our tooling (phpstan, cs-fixer) runs on the next version, but doesn't necessarily support new language features.

We upgrade the production environment when our tooling supports most of the new language features and at least all of the ones we want to make use of.

This usually happens within 3-6 months of the release. By that time the version has stabilized enough to be safe for production use.

Re: PHP 8.4

#42

Oftentimes many of the significant new PHP features are to fix the shortsighted implementation in the previous ones - for example this method chaining with `new` - there was precedent already, C++ got it right well before PHP even existed and with the very same arrow operator that PHP borrowed (and so did Java and JavaScript with .), so the question is why did PHP have to get it wrong at first and for so long. Anothe…

The global namespace change would break everything. It’s unlikely they would ever do something like that. It’s hard to build on a language used by so many, when you can’t modify the base. Python decided to do 2.7 vs 3 and fragmented the eco system terribly.

I think the bigger issue is that these lessons have already been learned. However, PHP (Personal Home Page) was not created carefully by someone to become a fully fledged language. It grew into that role organically which is why it has so many warts in hindsight.

Re: PHP 8.4

#44

Earlier quoted context omitted.

PHP fast? Compared to all popular web frameworks it's quite low in the pecking order when it comes to performance.

Not sure where you got that from. It’s equally if not faster then python, faster then Java, slower then compiled language, faster then ruby. Loses to NodeJS most of the time. But who cares, we are literally talking millisecond differences between them all. Throw a reverse proxy, DB into the mix and a few packages and they are all slow.

And if we actually want to talk speed, PHP with something like Swoole or ReactPHP is many times even faster[0] than the already fast regular PHP.

[0]: https://medium.com/@dimdev/9-php-runtimes-performance-benchm...

Re: PHP 8.4

#45
post #14

Earlier quoted context omitted.

Wikipedia is still on php 7.4.33 so don't feel too bad if you are behind.

For a project like Wikipedia, stability and continuity are far more important than latest and greatest feature support; in fact, there's an argument to be made to avoid newer language features to ensure consistency, that is, if new features are used, they should be used everywhere at once. Else you end up with frankenstein code where every file could use a different style.

"Else you end up with frankenstein code where every file could use a different style."

Yeah, this is a huge problem, but also, in the long run, inevitable.

Plenty of Kernighan & Ritchie C code still out there...

Re: PHP 8.4

#46
post #15

> PHP 8.4 is a major update of the PHP language. No it’s not: it’s a MINOR update.

It can be a major update even though it's a minor version bump.

It could have been, but isn’t. Most of those are rather small, incremental quality-of-life improvements. Nothing revolutionary.

Re: PHP 8.4

#47

Oftentimes many of the significant new PHP features are to fix the shortsighted implementation in the previous ones - for example this method chaining with `new` - there was precedent already, C++ got it right well before PHP even existed and with the very same arrow operator that PHP borrowed (and so did Java and JavaScript with .), so the question is why did PHP have to get it wrong at first and for so long. Anothe…

I don't get your issue with builtin utilities.

The design philosophy of PHP is to include whatever common methods would otherwise be in a popular library. (PHP actually began more as a library than as a language.) This differs from, eg, Python, but doesn't hurt.

The decision not not to make methods on the objects, but to include everything in the main namespace (so array_walk instead of Array.walk or Array()->walk etc) is another function of the same philosophy. It may not fit your idea of cosmetics, but there is nothing wrong with it.

On the other hand, I would love if PhP gained chainability ([].array_map.array_find()) and then the names would be a pain. If that ever happens there are solutions.

Re: PHP 8.4

#48

I'm just a PHP programmer for work, but I worry about the orientation PHP has chosen. As French people say: better is the enemy of good (Le mieux est l'ennemi du bien). The two new language features bring a higher language complexity for dubious gains. I hope I won't have to work with these. Property hooks mean that some language magic will turn a property access into a call to methods. It implies that `$this->x` has…

Just to set the record straight, Nikita is not the creator of the PHP JIT code, that is Dmitry and he is employed by Zend owned by Perforce working mostly on this.

Thanks for correcting me, and sorry for the error. I should have checked before writing.

Re: PHP 8.4

#49
post #6

These days, I am super torn about what language to use for new web projects. PHP: - Easy to deploy: Upload files, done. - Easy to develop: Reload page, see changes. - Lots of HTTP tooling built in. - Fast. Python: - Great language. - Great code reuse system: Modules. - Nice framework: Django. - Less breaking changes in recent years.

PHP has a rather nice type system. It also doesn't use whitespace as syntax, which makes it much easier to generate ad hoc.

Slim is a pretty nice framework: https://www.slimframework.com/

Re: PHP 8.4

#50

I have a question to the PHP-in-production crowd: how long do you wait before migrating to higher version of PHP? Is the first release usually already fine, or is it better to wait for a few months and let someone else catch the early errors?

Solo Dev on my own PHP project since 14 years.

I wait 1-3 months, but then update. It used to take way longer, because Amazon's Elastic Beanstalk platform would take longer to update, but I've now changed to Platform.sh and the transition should be easier.

It has been very backward-compatible (i.e. stuff that works in 8.n also works in 8.n+1; and unless you use exotic functions or are relying on special functionality, it should work for you, too).

Once I'm at 8.4, I would slowly update the code / syntax with rector and the assistance of phpstan.

For framework updates I wait 1-2 patch versions before updating, because of composer dependency problems and sometimes bugs do still find themselves into new releases (e.g. I would wait at least until Symfony 7.2.1 before upgrading from Symfony 7.1.x).

Post reply on HN