Live data from Hacker News

PHP 8.5

stitcher.io

11–20 of 197 posts

Re: PHP 8.5

#12
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…

> I think the danger with PHP is more its ability to easily cause very bad things.

Is there any language where you can't?

Re: PHP 8.5

#13
post #12
post #9

Earlier quoted context omitted.

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…

> I think the danger with PHP is more its ability to easily cause very bad things . Is there any language where you can't?

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

Re: PHP 8.5

#14
post #13
post #12

Earlier quoted context omitted.

> I think the danger with PHP is more its ability to easily cause very bad things . Is there any language where you can't?

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

Re: PHP 8.5

#17
post #12
post #9

Earlier quoted context omitted.

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…

> I think the danger with PHP is more its ability to easily cause very bad things . Is there any language where you can't?

It's like walking on minefields with very different "mine densities"; when using something stricter, you would have one mine per acre, with PHP you would have ten.

For the longest time the language had been developed with this mentality that it's okay to continue running if something broke, that it's better to print out something than to do nothing and bail out.

Which means that for things to run reliably, you have to write very defensive code that checks everything you can think of. Which is probably a good idea with any language, but I find that old PHP requires much more of this.

Thankfully, they've been changing that over the past decade while still maintaining decent compatibility with old code. I just recently finished porting a pretty large project (~2 mil SLoC) from the ten year old 5.6 to the currently latest 8.4, and it's been pretty painless. The only things that broke were those that were never actually properly implemented and worked by pure chance.

Re: PHP 8.5

#18
post #7

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

A lot of C# and Java code is oriented towards web backends, too. Which are quite big and complex. So it seems natural that languages in the same design space (trad OO) converge on similar features. I think the only exception these days is Go.

I think these days you could change "You can write Fortran in any language" to "You can structure your code like Spring in any language"…

Re: PHP 8.5

#19
post #7

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

Obviously you haven't heard of NativePhp :)

Still, even if it was "just" the web, why wouldn't it evolve? It's a great language, with a big user base, and there's always room for improvements and to increase the developer experience

Re: PHP 8.5

#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($);
Post reply on HN