Live data from Hacker News

PHP 8.1.0

php.net

241–250 of 286 posts

Re: PHP 8.1.0

#241
post #234
post #118

Earlier quoted context omitted.

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..

Indeed. A lot of the criticism is from people who never used the language (which seems to be true for any language/framework). This is why I'm very cautious when making assumptions about PHP's suitability - I haven't used it in the longest time and, when I did, I used it the same way one would use ASP or JSP - as a template engine that can do some logic before or after rendering a page.

Re: PHP 8.1.0

#242
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.

Being able to do a trivial hello world doesn't make a language elegant.

Re: PHP 8.1.0

#243

Earlier quoted context omitted.

True, but that’s self reinforcing. The more you use a hammer, the more confident you become in everything being nails.

And that’s when you become a master of your tools and can wield immense power with them! But in all seriousness, PHP is a good language, and coupled with a modern framework like Laravel, it’s great to use. I’ve used it since 2002, and have recently got back into it properly after a decade in architecture roles, and it feels very welcoming and love using it. And I _have_ tried the whole JavaScript thing, but simply fi…

> And that’s when you become a master of your tools and can wield immense power with them!

That still doesn't change the fact that, when you master hammers, you still have no idea of how to correctly use a screw.

Every language comes with some blind spots. Learning different languages is often enlightening because it forces one to see the solution space with a different kind of glasses.

Re: PHP 8.1.0

#244
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?

I am working with Kotlin for the last 2 years and have js / typescript / php experience. PHP is still a great choice to start new projects in for many web applications.

Re: PHP 8.1.0

#245
post #159
post #156

Earlier quoted context omitted.

Statistically PHP software has the most vulnerabilities. They are also quite different when compared to other languages. Language has many features which might be used unintentionally by programmer, leading for serious bugs. Not a good language to start with.

What features are used unintentionally leading to serious bugs?

Take a look for https://book.hacktricks.xyz/pentesting/pentesting-web/php-tr... for example. (Note also, that is the only programming language specific list, which is one mile long.)

Re: PHP 8.1.0

#246
post #217
post #189

Earlier quoted context omitted.

>Here is the one features that is taken for granted in "modern stacks": >Edit file -> Alt+tab ctrl+R. Oops, Alt+tab fix -> Alt+tab ctrl+R. Yeah, this is pretty much what the Common Lisp and Smalltalk people have been doing since mid 1980s. Except that they're not limited to web applications. And also python people to some extent, with ipython. And Haskell people with ghci. The value of less friction cannot be oversta…

> Except that they're not limited to web applications With PHP, you're not limited to web apps as well. The same rapid-fire style development can be applied when building CLI applications.

That's news to me. Does PHP have a REPL now with module reloading with lingering state?

Re: PHP 8.1.0

#247
post #83

Earlier quoted context omitted.

Iterating on ideas is much quicker when the compiler tells you when you made a mistake or failed to change your code after changing your mind.

Honestly, I don't see much difference. You learn either way. People may have preferences, that's fine. A compiler isn't a magical tool that creates bug free code.

A compiler with a good type system catches a mistake instantly instead of at runtime.

The difference in time it saves the dev can be anywhere from a few seconds to minutes per mistake.

Multiplied by hundreds of mistakes, it makes a huge difference. And that's not even getting into the advantages of better autocomplete for external libraries.

As someone who has written many thousands of lines of PHP, JS, TS, C#, Java, and Python, I now find it baffling that someone would start a project in 2021 without a great type system as a safety net.

Re: PHP 8.1.0

#248
post #175

Earlier quoted context omitted.

> 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?

I think they're referring to server-side rendering of SPA templates, which is something you get basically for free if your backend is written in NodeJS.

Re: PHP 8.1.0

#249
post #181

Earlier quoted context omitted.

Async/await isn’t something to hope for. It’s a terrible pattern languages should work hard to avoid.

Care to explain why?

"Async-await is nice, which is why we’re adding it to Dart. It makes it a lot easier to write asynchronous code. You know a “but” is coming. It is. But… you still have divided the world in two. Those async functions are easier to write, but they’re still async functions.

"You’ve still got two colors. Async-await solves annoying rule #4: they make red functions not much worse to call than blue ones. But all of the other rules are still there: ..."

You can continue the story at:

https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

Re: PHP 8.1.0

#250
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.

I see php sort of like a trusty hammer. It's a hammer. Doesn't have to be elegant. It's a hammer. The nails are http requests and PHP is a damn good hammer.

Cue the infamous double-claw hammer meme. I'd agree PHP is quite useful for web work, especially backend. And like a specialty hammer it wouldn't be useful in a lot of situations such as desktop apps or DB procedures.
Post reply on HN