←back to thread

PHP 8.5

(stitcher.io)
202 points brentroose | 1 comments | | HN request time: 0.209s | source
Show context
calpaterson ◴[] No.45989855[source]
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 well maintained PHP stacks.

replies(7): >>45990114 #>>45990185 #>>45990866 #>>45991594 #>>45992053 #>>45992060 #>>45992901 #
nusl ◴[] No.45990185[source]
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-experienced developers using it - most of them, early on - don't realise what's wrong until it's gone wrong.

With PHP being such an early tool online, and the above properties existing, it earned a reputation for being insecure and bad.

replies(3): >>45990227 #>>45990549 #>>45992539 #
ale42 ◴[] No.45990227[source]
> I think the danger with PHP is more its ability to easily cause very bad things.

Is there any language where you can't?

replies(2): >>45990242 #>>45990291 #
jojobas ◴[] No.45990242[source]
Probably not, but not most languages are not inviting to do them.
replies(1): >>45990256 #
s1mplicissimus ◴[] No.45990256[source]
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

replies(2): >>45990661 #>>45991053 #
Yokolos ◴[] No.45990661[source]
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).
replies(1): >>45990926 #
babuskov ◴[] No.45990926[source]
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.
replies(3): >>45991024 #>>45991028 #>>45991136 #
1. Yokolos ◴[] No.45991136[source]
So you're going to ignore the rest of what I wrote? I'll just assume you agree with me and the rest of my comment, but you don't want to admit it. Works for me.