←back to thread

PHP 8.5

(stitcher.io)
201 points brentroose | 1 comments | | HN request time: 0s | 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{3}[source]
Probably not, but not most languages are not inviting to do them.
replies(1): >>45990256 #
s1mplicissimus ◴[] No.45990256{4}[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 #
greiskul ◴[] No.45991053{5}[source]
The @ operator of php. In languages like Java, to silently catch all exceptions and do nothing with them requires at least some boiler plate.

PHP has an operator for something you should never do in a sane codebase.

You know that python wants good good to look good?

PHP was written in a way that makes bad code look good. And if we want Software Engineering to be a serious field that evolves, we have to be able to be honest with ourselves. It is a bad tool. Good programmers can even write good programs with bad tools. Doesn't mean you shouldn't avoid bad tools given the option.

There probably is a "PHP the good parts". But Javascript actually had a pretty nice core, and an utility of being in all web browsers that no other language could replicate. What niche does PHP have where it brings more value there other nicer languages can't be used instead?

replies(3): >>45991256 #>>45991277 #>>45992095 #
1. bawolff ◴[] No.45992095{6}[source]
> The @ operator of php. In languages like Java, to silently catch all exceptions and do nothing with them requires at least some boiler plate.

The @ operator doesn't get rid of exceptions it get rids of "warnings" which are basically built in log messages.

It used to get a bad wrap for also silencing fatal errors, but it stopped doing that a while ago.

The @ operator is something that should only be rarely used, but it is no way comparable to catching exceptions and doing nothing with them. There are sane uses for it.