Live data from Hacker News

PHP in 2022

stitcher.io

111–120 of 318 posts

Re: PHP in 2022

#111
post #9

Is it just me or PHP's evolution is a bit "too little, too late" for an almost 30-years old language? PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course. That, and also the fact that it ma…

Isn't ARC over a GC evident in PHP with its opcode cache? I don't think I have run into a PHP dev who thinks PHP has a GC

the very fact that you don't have to think about memory management it means that there is something else taking care of it. Call it GC or otherwise, no PHP dev will be think about memory management at all, unless they are building some long-lived, large data processing

Re: PHP in 2022

#112
post #89

Earlier quoted context omitted.

Because it's flexible and type-safe. You have both productivity and scalability on both syntax level and infrastructure level. It's suitable for 99% of programmers and the businesses for now.

But now you need a ton of time to type things.

Only a problem if you're trying to be too inventive with it.

For most cases it's enough to just define interfaces, enums and maybe bundle some of this into discriminated unions. Throw in some generics for good measure. That's not a lot of work.

I've seen people do stuff like dependent types, but unless you're writing a library you don't actually need most of the type system's features.

Re: PHP in 2022

#113
post #51
post #29

Earlier quoted context omitted.

There is a garbage collection: https://www.php.net/manual/en/features.gc.php > This section explains the merits of the new Garbage Collection (also known as GC) mechanism that is part of PHP 5.3. > First of all, the whole reason for implementing the garbage collection mechanism is to reduce memory usage by cleaning up circular-referenced variables as soon as the prerequisites are fulfilled. In PHP's implementation, t…

PHP's garbage collector is ARC, unlike any other dynamic language that I know of. ARC is more performant but can introduce memory leaks via circular references, which is probably not a big problem for short-lived scripts anyway.

I'm not sure if you did not read what I quoted, or I misunderstand something.

Yes, PHP has reference counting, but it also has specific process that kicks in to clean up circular references.

Re: PHP in 2022

#114
post #51
post #29

Earlier quoted context omitted.

There is a garbage collection: https://www.php.net/manual/en/features.gc.php > This section explains the merits of the new Garbage Collection (also known as GC) mechanism that is part of PHP 5.3. > First of all, the whole reason for implementing the garbage collection mechanism is to reduce memory usage by cleaning up circular-referenced variables as soon as the prerequisites are fulfilled. In PHP's implementation, t…

PHP's garbage collector is ARC, unlike any other dynamic language that I know of. ARC is more performant but can introduce memory leaks via circular references, which is probably not a big problem for short-lived scripts anyway.

How is it more performant? If you have multiple threads than you will get serious atomic operation or other synchronization overhead.

Re: PHP in 2022

#116

Earlier quoted context omitted.

You mean the most successful enterprise language and 2nd/3rd most used language overall? TBH, I don't think PHP is going in that direction.

No, just in terms of features and syntax. Too bad you can't remove all the bad stuff from php, or any old tech. This was one of my requests to that new search engine posted here a few days ago.. Filter on minimum version of technology. Should actually just be a field in stackexchange.. packages/languages references + version. And a marker to set if the information is obsolete.

> No, just in terms of features and syntax. Too bad you can't remove all the bad stuff from php, or any old tech.

You can, it just takes ages and dedication and will cause a lot of friction. See: Python's changes between 2.x and 3.x, .NET's breaking changes between 1.x and 2.x+

Re: PHP in 2022

#117
post #114
post #51

Earlier quoted context omitted.

PHP's garbage collector is ARC, unlike any other dynamic language that I know of. ARC is more performant but can introduce memory leaks via circular references, which is probably not a big problem for short-lived scripts anyway.

How is it more performant? If you have multiple threads than you will get serious atomic operation or other synchronization overhead.

PHP is share-nothing architecture. Nobody really uses threads in mainline PHP.

Whole class of problems around multi-threading, mutexes, dead locks etc. are really foreign to PHP developers.

Re: PHP in 2022

#118

Hating on PHP almost feels like racism. All the arguments are biased or false. I always get sad after clicking on PHP articles on HN.

I feel it's the opposite. Always a lot of people defending PHP in these threads, no criticism allowed. Gives a very misleading picture of the industry - in reality, PHP is not a loved language, it's below Powershell and just over C in the latest ranking[0] with 40% love / 60% dread.

[0]: https://insights.stackoverflow.com/survey/2021#technology-mo...

Re: PHP in 2022

#119
post #89

Earlier quoted context omitted.

Because it's flexible and type-safe. You have both productivity and scalability on both syntax level and infrastructure level. It's suitable for 99% of programmers and the businesses for now.

But now you need a ton of time to type things.

There is type inference. And also, it’s not a typing contest, if typing speed is your bottleneck in programming you are doing something really badly, I suggest plugging in the keyboard.

Re: PHP in 2022

#120
post #68
post #9

Is it just me or PHP's evolution is a bit "too little, too late" for an almost 30-years old language? PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course. That, and also the fact that it ma…

The big guys, who know what they're doing use PHP because it makes devops stupid simple. Throw it on the server, its ready. That's always been PHP's killer feature.

Is it? Last time I used PHP (around 5.x-7.x) it was exactly the other way around. For production you needed php-fpm, nginx, opcode cache... it was a nightmare compared with go or even java. Is it better now?
Post reply on HN