News for hackers. Stuff that matters.
Re:PHP 8.5 alpha 1 is available for download by moebrowne on Wednesday July 09, 2025 @04:56AM (#44507730)
8.5 notably includes the new pipe operator: https://stitcher.io/blog/pipe-operator-in-php-85
Re:PHP 8.5 alpha 1 is available for download by HackerThemAll on Wednesday July 09, 2025 @06:11AM (#44508139)
Great news! PHP is going to humiliate all its haters.
Re:PHP 8.5 alpha 1 is available for download by kriz9 on Wednesday July 09, 2025 @08:27AM (#44509203)
I feel like if you treat temporary variables as documentation they feel less icky. All these examples with the pipeline operator cause way more mental overhead than reading temporary variable names.
Re:PHP 8.5 alpha 1 is available for download by V__ on Wednesday July 09, 2025 @09:10AM (#44509627)
I think it really depends on what operations you are applying. Having one succinct named variable like $slug with a few simple pipeline calls like in the example is "self-documenting" and easy to read. However, some lambdas and non-standard function are definitely a place for nicely named temporary variables in my opinion.
Re:PHP 8.5 alpha 1 is available for download by xdfgh1112 on Wednesday July 09, 2025 @09:37AM (#44509904)
Kind of a clunky and verbose syntax at the moment. I wonder what languages get pipe syntax right?

Obligatory: Raku supports pipe in both directions, passing input as the last parameter instead of requiring the function to take only one parameter. It also has a shorthand:

my @array = <7 8 9 0 1 2 4 3 5 6 7 8 9>; my @final-array = @array.unique.sort.reverse; say @final-array;

Re:PHP 8.5 alpha 1 is available for download by moebrowne on Wednesday July 09, 2025 @09:49AM (#44510034)
There is a complementary Partial Function Application RFC which, among other things, solves the one-parameter limitation. It allows a question mark to be substituted in for the piped value:

$foo |> str_replace('hello', 'hi', ?);

https://wiki.php.net/rfc/partial_function_application_v2

Re:PHP 8.5 alpha 1 is available for download by tslocum on Wednesday July 09, 2025 @10:38AM (#44510576)
Based on the examples given in the blog post, this appears to be a massive step backwards for PHP. The language has been making an effort to clean itself up for years. The author claims that the temporary variable solution "feels icky". If we ultimately care about readability and performance, temporary variables seem ideal even with this change in the language. Modern compilers look for things like temporary variables when performing optimizations. PHP's compiler probably already does this, and if it doesn't, adding support for that would make more sense than adding some new syntax.
Re:PHP 8.5 alpha 1 is available for download by phendrenad2 on Thursday July 10, 2025 @11:30AM (#44522133)
I'm not complaining, and I respect the PHP team for continuing to try to improve the language, but I think that we might have passed the point where new additions to the language actually make it worse.
Re:PHP 8.5 alpha 1 is available for download by phplovesong on Wednesday July 09, 2025 @02:40PM (#44513450)
Still no unicode support? What in the hell are the devs doing? Looks like they still force that nasty mb_real_uppercase and pals on you.
Re:PHP 8.5 alpha 1 is available for download by syndeo on Wednesday July 09, 2025 @04:00PM (#44514197)
Maybe waiting for a major version, perhaps 9.0… hopefully.

Not that I have any skin in that game anymore; I moved my stack from PHP years ago.

Re:PHP 8.5 alpha 1 is available for download by kassner on Wednesday July 09, 2025 @04:57PM (#44514675)
What do you mean? It was released with PHP 6.0 /s
Re:PHP 8.5 alpha 1 is available for download by phendrenad2 on Thursday July 10, 2025 @11:09AM (#44521930)
And yet millions of websites built on PHP happily serve unicode content to billions of users. Strange.
Re:PHP 8.5 alpha 1 is available for download by phplovesong on Sunday July 13, 2025 @03:48PM (#44553064)
I have seen many cases of weird casing on web pages (not critical, but usually embarrasing), not knowing the backend tech, but i always hard bet its php.
Re:PHP 8.5 alpha 1 is available for download by phendrenad2 on Tuesday July 15, 2025 @12:53AM (#44567929)
I do think it's an issue, but a much, much smaller one than is immediately obvious. Most people aren't doing weird text processing on the fly in PHP.
Re:PHP 8.5 alpha 1 is available for download by senfiaj on Thursday July 10, 2025 @08:07AM (#44520064)
Still PHP's syntax leaves much to be desired, especially the arrays. https://waspdev.com/articles/2025-06-12/my-honest-opinion-ab...