Live data from Hacker News

PHP 8.1.0

php.net

231–240 of 286 posts

Re: PHP 8.1.0

#231
post #175
post #108

Earlier quoted context omitted.

There isn't a language that can replace php in 2021. Javascript doesn't have the size of build-in library. Golang is compiled and limited, blank spaces/tabs will kill a Python program. Ruby /rails is slower. All are harder to host. What could you replace php with? The tales of legacy mistakes holding back php are things with no basis in reality. What legacy mistake holds php back? Method names/parameter ordering? Whe…

> Javascript doesn't have the size of build-in library. Golang is compiled and limited, blank spaces/tabs will kill a Python program. Ruby /rails is slower. I have once heard an ancient prophecy (I think it's Greek) that says "Debating around PHP online summons the ghost of the dark behind your back" or something like that (I don't speak Greek, sorry). In the Client/Server world now days, the most of the time you onl…

> Server-side Rendering, which no other backend-only language could do

Isn't it the definition of a "backend-only language" that it renders server-side?

Re: PHP 8.1.0

#232
post #183
post #32

Earlier quoted context omitted.

Elegant is not the word I'd use to describe PHP. Solid, perhaps. Undoubtedly useful. But if there is elegant PHP, I haven't seen it.

Hello World in PHP is literally Hello World I know no other language that elegant.

m4

Re: PHP 8.1.0

#233
post #183
post #32

Earlier quoted context omitted.

Elegant is not the word I'd use to describe PHP. Solid, perhaps. Undoubtedly useful. But if there is elegant PHP, I haven't seen it.

Hello World in PHP is literally Hello World I know no other language that elegant.

From the top of my head, Javascript and Common Lisp will also work with "Hello World" (with quotes).

Re: PHP 8.1.0

#234
post #118
post #77

Genuinely curious: who here thinks PHP is a good choice for a new project and also has experience with other languages such as Scala, Kotlin, Python, or JavaScript and their respective web frameworks?

Kotlin is for Android apps. Scala is a Java replacement. Those frameworks are unrelated. Are you talking about building an Android app? I've built app in different Javascript frameworks. Angular, Vue, React. If I was building a website I would use PHP over Python, Golang or Javascript frameworks because what you get out of the box doesn't compare. Each language does something well. If I was building AI python would b…

> Kotlin is for Android apps

Welp, guess all my Spring Boot web apps in Kotlin have actually been Android apps in disguise all this time..

Re: PHP 8.1.0

#235
post #183
post #32

Earlier quoted context omitted.

Elegant is not the word I'd use to describe PHP. Solid, perhaps. Undoubtedly useful. But if there is elegant PHP, I haven't seen it.

Hello World in PHP is literally Hello World I know no other language that elegant.

The easiest Quine imaginable!

Re: PHP 8.1.0

#236
post #18

Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

I’ve been writing PHP since the 3-4.X days (over 20 years). I’ve written tens of thousands of lines of PHP, in several fairly large-scale server systems.

I’ve never learned to like the language, but have gotten pretty proficient with it. I don’t claim to be a PHP maven, though. I know that my style is fairly “primitive.”

I tend to use it for my backend work. It’s quite performant, has huge infrastructure support, and it’s entirely possible to write safe, high-quality, low-level systems in PHP. I’m a good engineer, and do a decent job; regardless of the tool I use.

C++ is the same way. People have been hating on that language for even longer than they have, PHP. C++ is still used for many major infrastructure projects, though; because it’s the best language for that kind of thing.

If you give a kid a chainsaw with the guard removed (as most arborists do), don’t be surprised, when the screaming starts.

Re: PHP 8.1.0

#237
post #183

Earlier quoted context omitted.

Hello World in PHP is literally Hello World I know no other language that elegant.

From the top of my head, Javascript and Common Lisp will also work with "Hello World" (with quotes).

I can’t speak for Lisp, but JavaScript isn’t going to write that to standard out, it would just be a statement that didn’t do anything.

You would need something like

    import { stdout } from 'process';
    
    stdout.write("Hello World");

Re: PHP 8.1.0

#238
post #93

Earlier quoted context omitted.

With a proper type system you don’t need to run your code 50 times a minute.

Code that passes type checks can also fail to solve the user's problem, make 10,000 database calls, or render a page that is completely unreadable. The human in the loop is a good thing. All things being equal, the type system is also a good thing, but what usually happens is that you end up checking your page once a minute or once every 10 minutes, not 50 times in a minute. That difference can make or break a projec…

And for those cases you should use tests, not a manual procedure.

Of course you will need some manual procedure, and e2e tests, but not “50 times a minute”. That is just frustrating.

Re: PHP 8.1.0

#239
post #197
post #166

Earlier quoted context omitted.

I write PHP for my job almost every day, and have for the past 4 years, and there's some truth to what you say: anything you can write in another language, you can also write in PHP. Personally, I can't stand writing PHP, because, sure, I can write secure, testable, safe code in any language, including PHP, but, how do I say this, PHP is the only language that feels actively hostile to my attempts to do so. The house…

> When I write Javascript or Python, I have complaints and issues, but I enjoy writing code. I think PHP, for many programmers, including myself, is just a hostile and unenjoyable experience. Surely JS has at least an equal amount of foot-guns to PHP. I mean, at least PHP (to my knowledge) never had a meta-language written around it that compiles to PHP to make it safer.

Did Hack start that way, or am I misremembering?

Re: PHP 8.1.0

#240
post #136

Earlier quoted context omitted.

With a proper type system you don’t need to run your code 50 times a minute.

I never seen any practical proof of that often repeated claim. Unless you define "proper" in an absurd way that has absence of bugs as the part of its definition, I've seen roughly as many bugs and as much time spent debugging in strongly typed languages as I have in weakly typed ones. Sure, some kinds of bugs go away, but they're replaced with different ones.

Just try it out.

I am not saying that a type system will find all bugs. It will stop you from running incorrect code “50 times a minute”. Then you should have tests. Lastly you must also do some manual procedure (or run slower e2e tests).

Doing all this yourself constantly is just frustrating.

Post reply on HN