Live data from Hacker News

PHP 8.5

stitcher.io

21–30 of 197 posts

Re: PHP 8.5

#21
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($);

The three dots in trim(...) make a callable out of a function, that was already in, so seem best to re-use that syntax, at least for now. [1]

As for the partial function application, there is already an RFC to add that, but it's not decided on as of now. [2]

1: https://www.php.net/manual/en/functions.first_class_callable...

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

Re: PHP 8.5

#22
post #7

PHP becomes a complex language with each update. For what reason? Its application is still limited to the web, mostly.

The web is not getting any simpler.

Exactly, I'd even argue that web development (back & front-end) is by far the largest job / industry in software development.

Re: PHP 8.5

#23
post #9

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…

PHP is a very pleasant and straight-forward language to work with. I enjoyed my time working with it, though I did also see quite a lot of very poor code. I think the danger with PHP is more its ability to easily cause *very bad things*. This would partially be poor training (my University literally taught PHP with SQL-injectable examples), and I think the language itself making it very easy, such that less-experienc…

At least in my experience, the early years of PHP was lacking more enterprisey users; back then there was a small revolution when RoR came out and introduced the MVC pattern to a lot of (web) developers, who didn't have as opinionated a pattern / architecture up until then.

During that same period, there were a lot of mediocre tutorials and documentation online, including on the PHP website itself which allowed people in comments to post code examples, but as far as I know there wasn't a lot of moderation on those.

And finally, a lot of people ended up writing their own frameworks and the like, because they could. But also because there weren't any or not many good and widely adopted frameworks out there, that came later with first Zend Framework and then Laravel, the latter being the de-facto standard nowadays.

Re: PHP 8.5

#25
post #13

Earlier quoted context omitted.

Probably not, but not most languages are not inviting to do them.

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. And I'd rather work with a bad Java project than any bad PHP project (which I have had the misfortune of maintaining).

Re: PHP 8.5

#26
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 the community but a barrier to re-entry.

Re: PHP 8.5

#27

    Backticks as an alias for shell_exec() are deprecated
Used that a lot in shell scripts. using php-cli.

like in `mkdir $dirname`;

Re: PHP 8.5

#28
I still love PHP. 23 years ago we created some encryption software for it and it is still going. I also run a PHP newsletter. There's still a strong community of people and whilst there are other languages which I also use (Python, Node.js) I still find myself gravitating towards PHP for fast and simple work

The only issues I have. is that this is a 'double edged sword' in that PHP has become far more complex since the launch of PHP 5 and so it isn't as easy to understand from scratch as it used to be

Re: PHP 8.5

#30

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…

IMO, newer PHP is still very readable. I programmed with C++ for a decade, but I can safely say that I cannot understand a modern C++ code base anymore.
Post reply on HN