Live data from Hacker News

PHP 8.5

stitcher.io

31–40 of 197 posts

Re: PHP 8.5

#31
PHP should REALLY focus on getting the core stuff in shape.

Its still so annoying that you have to use mb_real_uppercase($name) for unicode. The other gripe is that the stdlib is SO messy. With PHP 5.3 they had a once in a lifetime opportunity to cleanup the stdlib and introduce a new namespaced API for builtins, and optionally introduce a uniform function call syntax:

    "foo"->strtoupper();
Whenever doing PHP the time for concurrency will come sooner or later. Having no way of doing ANY concurrency is a letdown. The Fiber API does nothing on its own, and you are forced to use some third party runtime, that is usually a non-starter for legacy projects.

PHP has come a long way from the PHP 4.0 era, but is still lacking in multiple areas, and i dont see it being a pick for greenfield projects in 2025.

Re: PHP 8.5

#32

PHP's evolution since PHP 5 has been substantial, and I think this is a real problem. As someone who learned the language years ago, the pace of change (generics, attributes, match expressions, typed properties) makes modern codebases genuinely difficult to follow. I suspect this affects many developers who cut their teeth on PHP but haven't kept up. The language has become a different beast, which is a strength for…

PHP has no generics? I read somewhere that is was "too hard" to get right in PHP land, mostly because of how primitive the typesystem is.

Re: PHP 8.5

#33

PHP's evolution since PHP 5 has been substantial, and I think this is a real problem. As someone who learned the language years ago, the pace of change (generics, attributes, match expressions, typed properties) makes modern codebases genuinely difficult to follow. I suspect this affects many developers who cut their teeth on PHP but haven't kept up. The language has become a different beast, which is a strength for…

I think PHP is way better now than it used to be. Learn PHP 8 and you are good to go.

Re: PHP 8.5

#34
Why is it that all these languages like PHP, but also typescript are becoming like impossible puzzles to read. I find these generics, types and other language features very often causing complex software architecture. I see so many collegues these days struggling in understanding codebases. You almost need a PHD brain to be a frontend web developer.

Re: PHP 8.5

#35

A lot of people are too proud to be associated with PHP. I am ready to admit that know nothing about the language except that a lot of people make cool things with it. My favourite PHP product at the moment is BookStack ( https://www.bookstackapp.com/ ), a really good wiki. I run an instance for my family and it's great. But there are loads of things. And I notice that many of the sites I like using...are built on we…

I'd take PHP instead of JS/TS + framework-of-the-day on the backend anytime. Ok, PHP is usually also paired with a framework (cough Laravel cough), but at least there the situation is more stable, not to mention more mature. Unfortunately, I'm not the only one making the decisions...

Re: PHP 8.5

#36
post #25

Earlier quoted context omitted.

Give me an example where PHP invites developers to do terrible things and I'll show you 2 other popular languages that invite equally bad or worse things :) Or as Bjarne Stroustrup put it: There's two types of languages: The ones people complain about and the ones noone uses

You can do crazy things in every language. However, in a language like Java, the crazy things are more conceptual (factory for factory of factories) and not basic things like what does == mean or problems with weak typing and implicit conversions. A lot of the issues with PHP can be avoided in modern PHP using things like strict_types=1, but most of the time, we don't get to work with projects using best practices. A…

Funny that you picked == as an example when == is very counter intuitive in Java and is one of the common pitfalls for beginners:

    String a = new String();
    String b = new String();
    a = "test";
    b = a + "";
    
    if (a == "test")
    {
        // true
    }

    if (b == "test")
    {
        // false
    }

    if (a == b)
    {
        // false
    }
        
Just like PHP, you have to read the docs to use it properly.

Re: PHP 8.5

#37
post #20

When I look at the new pipe syntax ... $output = $input |> trim(...) |> (fn (string $string) => str_replace(' ', '-', $string)) |> (fn (string $string) => str_replace(['.', '/', '…'], '', $string)) |> strtolower(...); ... I think why not just something like the following? $output = $input |> trim($) |> str_replace(' ', '-', $) |> str_replace(['.', '/', '…'], '', $) |> strtolower($);

That example in article is straight up terrible. The Java version would be:

  var input = "Some kind of string.";  
  var output = Optional.of(input)
    .map(i -> i.trim())
    .map(i -> i.replace(' ', '-'))
    .map(i -> i.replaceAll("[./…]", ""))
    .map(i -> i.toLowerCase())
    .get();
That is until you realize there is no reason to go weird with arrow operators when String is an object:

  var input = "Some kind of string.";        
  var output = input.trim()
    .replace(' ', '-')
    .replaceAll("[./…]", "")
    .toLowerCase();
It looks like they solved the wrong issue but that is probably just side effect of using trivial examples.

Re: PHP 8.5

#38

PHP's evolution since PHP 5 has been substantial, and I think this is a real problem. As someone who learned the language years ago, the pace of change (generics, attributes, match expressions, typed properties) makes modern codebases genuinely difficult to follow. I suspect this affects many developers who cut their teeth on PHP but haven't kept up. The language has become a different beast, which is a strength for…

This is true for most languages though, compare C# 14 with C# 1.0, Java 25 with Java 1.0, C 23 (plus common compiler extensions) with K&R C,....

Re: PHP 8.5

#39
post #25

Earlier quoted context omitted.

You can do crazy things in every language. However, in a language like Java, the crazy things are more conceptual (factory for factory of factories) and not basic things like what does == mean or problems with weak typing and implicit conversions. A lot of the issues with PHP can be avoided in modern PHP using things like strict_types=1, but most of the time, we don't get to work with projects using best practices. A…

Funny that you picked == as an example when == is very counter intuitive in Java and is one of the common pitfalls for beginners: String a = new String(); String b = new String(); a = "test"; b = a + ""; if (a == "test") { // true } if (b == "test") { // false } if (a == b) { // false } Just like PHP, you have to read the docs to use it properly.

[deleted]

Re: PHP 8.5

#40
post #25

Earlier quoted context omitted.

You can do crazy things in every language. However, in a language like Java, the crazy things are more conceptual (factory for factory of factories) and not basic things like what does == mean or problems with weak typing and implicit conversions. A lot of the issues with PHP can be avoided in modern PHP using things like strict_types=1, but most of the time, we don't get to work with projects using best practices. A…

Funny that you picked == as an example when == is very counter intuitive in Java and is one of the common pitfalls for beginners: String a = new String(); String b = new String(); a = "test"; b = a + ""; if (a == "test") { // true } if (b == "test") { // false } if (a == b) { // false } Just like PHP, you have to read the docs to use it properly.

This is a decade-old PHP defence fallacy. No one says other languages have no problems, so "disproving" that is the fallacy. PHP just has far more problems and footguns. Maybe now it has fewer, but still. Far more.
Post reply on HN