Live data from Hacker News

What's New in PHP 8.1

stitcher.io

41–50 of 112 posts

Re: What's New in PHP 8.1

#41
post #19

I recently killed all my PHP code in favor of Go. What finally convinced me is the Go package system. I like that Go has a builtin package manager, while I dont think PHP does. I know about Composer, I just wonder. After all these years, why hasnt PHP incorporated a builtin package manager?

As long as you got a strong package manager and good ecosystem around it everything is ok. Many languages don't have built-in package manager.

Re: What's New in PHP 8.1

#42

> array_is_list This is a stupid solution to a stupid problem. Defaulting to weak typing has enough problems, but changing the behavior of your data structure based on its contents is next-level pain. I used PHP for a few years at a student dev job and I can’t count how many times this conflation wasted my time and introduced various bugs. If PHP wants to become more respectable as a PL, it has got to break that out…

> changing the behavior of your data structure based on its contents

PHP does no such thing. There is one array type with one behaviour. There is no distinction between different kinds of arrays in the language.

Re: What's New in PHP 8.1

#43

I am not a developer, but I use PHP a lot for scripting and personal automation including small web apps with SQL backend. I found PHP 7 to be a great improvement over 5.x, but with 8 I skipped every single new thing they brought. I can use PHP 8.1 in PHP 7.4 compatibility mode, but I find the features in 8.1 making the language less readable and less logic; for example, 3 dots become part of the language syntax? Wha…

Fun fact: failure to implement unicode is the reason we never got a PHP6. So we're safe from emojis for at least a while.

PHP supports Unicode, just not in a Python 3-like way.

Re: What's New in PHP 8.1

#44
post #17

Earlier quoted context omitted.

Erlang, Haskell and OCaml are excelent languages. But good luck assembling a team that can use those languages. e.g.: 30 developers in 1 year. And those languages are pretty popular compared to others. The programming language you use is a important factor when it comes to scaling your team (and your product, and your business). I do not want to start a bikeshedding holy war. The reference implementation of PHP is pr…

I don't agree with this. I'm not going to get into a holy war, but I soundly disagree that it's inferior. Any C/C++/Java programmer can become productive with php very rapidly. The callstacks are familiar to programmers, the language continues to get faster & faster as older legacy structures are replaced with smarter data-structures allowing for JIT optimizations.

There are more Java jobs than PHP jobs and Java jobs usually pay better than PHP jobs.

Re: What's New in PHP 8.1

#45
post #33
post #3

"New array_is_list function" I use PHP a fair amount, but this is one area that irks me. PHP arrays can be arrays, lists, and hash maps. PHP obviously copied some of Perl's features, and I never understood why hashmaps and arrays weren't different types, as they are in Perl.

I love them. Lisp can use lists for everything, and PHP arrays ;) Thanks to their mixed nature they're very versatile. People even make small DSLs out of them. And they're order-preserving, so they won't inject non-determinism just to smugly teach you a lesson about real hash tables.

Shots fired at Golang

Re: What's New in PHP 8.1

#46

I do not think PHP is a good language to use in a project. - dev recruitment is hard. - dev retention is hard. - hard to find people that write clean, modern, performant PHP - it is PHP, with everything that it entails. It does not enjoy the best reputation as a language.

PHP is incredibly easy for any competent programmer to pick up. If you know C/Java you can get into php pretty easily. If you use structured projects, (symfony) in our case its much easier to use and maintain. We have older Java and Perl and Python to maintain. Its much harder to get those up and running. The startup I worked at 8 years ago used PHP and got bought. I think the ability to get into it quickly and get s…

PHP was the most competitive when ASP was around. After that, PHP entered a dark age where almost every other language ran circles around it in terms of performance, security, maintainability, tool support... and literally everything.

Some of those problems got addressed but by the time that happened PHP's reputation was irreversibly trashed and now nobody wants to know about it.

That is the world we live in. People do not want to learn PHP or work in PHP. Do a survey on any higher education institution and verify it yourself.

All the features you feel proud about... go take a look at the Java VM, .NET VM or a JS VM like V8... Those VMs are much more powerful than the PHP interpreter will ever be. Even CPython is faster.

Plus, as a Java developer you can make more than a PHP developer and there are more types of development you can do. Mobile, backend, desktop. PHP is mostly limited to backend and it is not even the best solution for that.

Re: What's New in PHP 8.1

#47
post #8

Earlier quoted context omitted.

Funny. I almost dislike all of PHP but think that their choice of basic data structure is the one good thing. Computers are getting faster and faster and simplifying programming could be done to a whole new level. Clojure for example has a similar approach. Okay, PHP lacks contracts, but maybe PHP adds them in 20 years when the mainstream understands that they are great.

I too dislike PHP, but this is one of the things I hate the most: this is like conflating addition and multiplication of types. Arrays and maps have separate use cases and very different trade-offs and PHP gives you no choice in the matter.

In fairness, it does give choices -- https://www.php.net/manual/en/spl.datastructures.php

Re: What's New in PHP 8.1

#48
post #27

This is really making what used to be an easy to read, easy to learn language a lot less of that. Some of us still don’t use IDEs and are okay with more thoroughly defined code that is readable. If people are so gung ho on adding in syntax hacks, shortcuts, etc, they seem to be bringing ideas from other languages and why not simply continue to use that other language? PHP seems to be looking more and more like Go or…

Are you saying you do not use IDEs? What is your rationale for that decision?

I just use emacs. It has enough capability to be an IDE, but I don't use it like that. I use it as an editor, maybe with a language mode to do syntax highlighting and help with formatting.

I tried Visual Studio years ago, didn't care for it.

Re: What's New in PHP 8.1

#49

Earlier quoted context omitted.

PHP is incredibly easy for any competent programmer to pick up. If you know C/Java you can get into php pretty easily. If you use structured projects, (symfony) in our case its much easier to use and maintain. We have older Java and Perl and Python to maintain. Its much harder to get those up and running. The startup I worked at 8 years ago used PHP and got bought. I think the ability to get into it quickly and get s…

PHP was the most competitive when ASP was around. After that, PHP entered a dark age where almost every other language ran circles around it in terms of performance, security, maintainability, tool support... and literally everything. Some of those problems got addressed but by the time that happened PHP's reputation was irreversibly trashed and now nobody wants to know about it. That is the world we live in. People…

It sounds like a sad story. PHP's specialization is in rendering dynamic web pages. It was its ONLY purpose (ignoring niche projects like GTK bindings, etc). And yet even against general purpose languages/VM's (where using it for backend web is a choice, not its only purpose), PHP could not remain competent in its own class.

It's like building a car designed for just one thing, to go very fast on straight roads, then a general-purpose car comes along and somehow beats this car in this category.

How did it lose its grip? Did the PHP Group become too complacent being at the top?

Re: What's New in PHP 8.1

#50
One thing I still love about PHP is that it's so easy to deploy.

No need for fancy Amazon Web Shmervices, no need for Jamstack jumping through the hoops.

Just find any host that supports PHP, upload your file, and done.

Post reply on HN