> I mean your proof is I seen PHP code then conclusion is PHP is bad.
You're over simplifying my point to make yours.
I have seen bad PHP code. I have seen bad Go code. I have seen bad code in many languages.
The proportion of bad PHP code however, is higher in PHP, for the reasons I've stated around edge cases and the difficulty in reasoning.
> You are trying to compare PHP with Go, probably Go is better then PHP, but if Go is better that does not mean PHP is bad, just that Go is better (probably not for all use cases).
Go being good doesn't make PHP bad, and PHP being bad doesn't make Go good. I'm not saying one thing is true because the other thing. I'm saying that PHP is a bad language.
> So you have experience with PHP, probably are you thinking at html code mixed with PHP code? yeah that thing is bad but only news use that for large projects.
Nope, you're making untrue assumptions about my experience. The largest project I worked on was over 300,000 lines of PHP and used templating. It controlled everything from a companies finances, to printing plate layout, to believe it or not, sorting robots on a conveyer belt.
> If you do not mean that then I am not sure what PHP issues prevent you to write good code.
I've talked about this. Edge cases and the inability to reason about the code. In PHP there are a ton of weird little behaviours or edge cases that you just have to know about that could cause bugs. It's hard to know all of these, and even if you do the sheer number of intricacies of the language means that it would be easy to miss some.
PHP isn't alone in this. Go has little gotchas, Ruby has a fair few, Javascript has plenty, but PHP has loads.
Here's some that are utterly trivial to find. There are plenty more. Feel free, as a supposedly competent PHP programmer, to go and find the rest, becayse you definitely need to know about them to be able to write code that's going to work properly.
Moved the examples to a gist due to HN formatting:
This gotchas are similar to JS or Python ones. I hit more issues related to php configuration or server configuration then language issues, maybe because I use a good IDE that will prevent such trivial bugs.
There are edge cases in many languages, there are more in PHP. It would be better to not have the edge cases than to have an IDE that tried to pretect you from them.
I agree with you in most part, just it seems you imply PHP is the worse, I assume you mean is worse then Go,Python ,JS etc.
As I said earlier if PHP < Go it does not mean PHP is a dull tool and not suitable for some projects.
If you disagree I am curious of a really example of something that is super hard to do in PHP compared to Python/Ruby/Go , some real world thing. I am aware of the weak points of PHP but I think you can do your job with it, the language is not dragging you down.
I absolutely believe that PHP is worse than many, if not most, other langauges. I have programmed (in a non-trival way) close to 10 programming languages (and fiddled with more) over more than 20 years. Of all those, there are only two that I hate, PHP and Javascript.
PHP (and to a lesser extent JS) are the only languages (that I have experience of) that it seems actively work against the developer writing bug free programs.
Tools reach a point where they can be considered to be dull, and they're not dull before that. PHP in my experience and opinion has crossed that boundary.
> it does not mean PHP is a dull tool and not suitable for some projects.
I think it depends. Should you use PHP for small stuff? one-off's that you run on your home network? I mean, you could, right? No-one's going to access it other than you, so you don't have to worry about user supplied data. But should you use it for Internet facing stuff? Shopping carts, user data? The difficulty is going to be ensuring that you've not coded bugs or security problems into your code, so I would say the answer there is no. I looked, there's been a study (there might be more than one, this was the first result) that has found that PHP is more prone to defects than a lot of other languages (beaten only by c and c++): https://www.i-programmer.info/news/98-languages/11184-which-...
The interesting quote:
"The languages with the strongest positive coefficients - meaning associated with a greater number of defect fixes are C++, C, and Objective-C, also PHP and Python. On the other hand, Clojure, Haskell, Ruby and Scala all have significant negative coefficients implying that these languages are less likely than average to result in defect fixing commits."
This is my experience both writing PHP (lead developer for over a year on a 300k line plus app), and reading it. PHP is hard to write well.
So if you have decided it's not for you with the big projects, why bother with the small ones? They might after all become big projects, but even it they don't, the other languages aren't really that hard. I wrote a Go program yesterday that reads temp and humidity off an i2c bus connected sensor on a Raspberry Pi and writes the data to an influx DB. It is less than 100 lines. It can run from systemd, it uses threads, it's damn fast, and it was even easier to deploy than PHP necause it's just a binary.
It's also far far less likely to have bugs in it.
> If you disagree I am curious of a really example of something that is super hard to do in PHP compared to Python/Ruby/Go , some real world thing. I am aware of the weak points of PHP but I think you can do your job with it, the language is not dragging you down.
You can pretty much do anything in PHP that you can in other languages, it's turing complete after all, but then again, so is the sendmail configuration language.
The issue with PHP is that it makes the task of writing bug free software so so hard.
You're over simplifying my point to make yours.
I have seen bad PHP code. I have seen bad Go code. I have seen bad code in many languages.
The proportion of bad PHP code however, is higher in PHP, for the reasons I've stated around edge cases and the difficulty in reasoning.
> You are trying to compare PHP with Go, probably Go is better then PHP, but if Go is better that does not mean PHP is bad, just that Go is better (probably not for all use cases).
Go being good doesn't make PHP bad, and PHP being bad doesn't make Go good. I'm not saying one thing is true because the other thing. I'm saying that PHP is a bad language.
> So you have experience with PHP, probably are you thinking at html code mixed with PHP code? yeah that thing is bad but only news use that for large projects.
Nope, you're making untrue assumptions about my experience. The largest project I worked on was over 300,000 lines of PHP and used templating. It controlled everything from a companies finances, to printing plate layout, to believe it or not, sorting robots on a conveyer belt.
> If you do not mean that then I am not sure what PHP issues prevent you to write good code.
I've talked about this. Edge cases and the inability to reason about the code. In PHP there are a ton of weird little behaviours or edge cases that you just have to know about that could cause bugs. It's hard to know all of these, and even if you do the sheer number of intricacies of the language means that it would be easy to miss some.
PHP isn't alone in this. Go has little gotchas, Ruby has a fair few, Javascript has plenty, but PHP has loads.