Live data from Hacker News

PHP in 2019

stitcher.io

61–70 of 489 posts

Re: PHP in 2019

#61
post #51

As far as I'm concerned the bridges have burned a long time ago and I definitely can't see myself giving PHP a second chance. That being said, if I'm wrong and PHP has really managed to become a decent language (or at least something that's not completely insane) its defenders should focus on actually showing what modern PHP code looks like. Is performance that much of a big deal for most people? In a world where Rub…

> [...] its defenders should focus on actually showing what modern PHP code looks like.

Laravel does this very well, not just by being a great framework but also in its ecosystem (Envoyer, Forge, Spark, Nova, Horizon, Socialite) and its documentation (https://laravel.com/docs/master).

Re: PHP in 2019

#62

Earlier quoted context omitted.

Unfortunately this is true and it can't be changed, the functions are named and parameters are soemtimes inconsistent like strpos and str_replace, I would have to use the docs all the time if my IDE wouldn't show me the param names. But after you get productive with PHP there is no feature that I think I am missing from other similar languages.

It can be changed. You have some syntax to opt into a later release (e.g. doing ` In a major release, you then get rid of a load of cruft.

> You have some syntax to opt into a later release (e.g. doing `imagine the exponential complexity as old behaviours need to be kept around for various levels of opting in.

Re: PHP in 2019

#63

And yet ~everything in https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ is still true. All that's happened is that the language is even more complex, has even more baggage.

I'm not really sure why this comment is getting downvoted, but literally every single thing in that post still holds true.

Re: PHP in 2019

#64
post #19

It might not be, but how does it fare against similar languages? I have no idea why you'd choose it over Go/Node.js/Ruby or similar for your standard webdev stuff.

All apps I saw, written in Ruby, were awfully slow. I don't know Ruby, maybe it's just me, but would be interesting to know examples of not slow Ruby apps.

Well, github, just to name one:). Also shopify, digital ocean, stripe. I also worked on a large ruby app that was faster than another large Java app. Keep is mind that all these platforms handle a great deal of requests at any given time, so we're not talking simple web apps.

In my experience bad software design, bad DB design and bad developers are the major cause for performance issues, you rarely get to that level of polish with your app that the difference between different languages really matters.

At micro-bench level PHP always beats ruby pr python, but most apps have performance issues without ever getting to that level.

My funnies experience was with a java team that where baffled why their app is slow. I told them it looks like they have a huge bottleneck on the DB, their answer: "Yeah but it's java, it should be fast"

Re: PHP in 2019

#65
post #49

Earlier quoted context omitted.

Your claims are vague, do you have a specific example of a new feature and a new mainstream framework that has the security issues you mention?

I think the point is that if you use a "new mainstream framework", you lose the traditional unique strengths of PHP by using it essentially the same way as you would any other language, so you might as well use a different language. So instead of trying to be like other languages but with worse syntax and weird quirks, PHP could try to improve on the things that make it different and lead to its initial popularity.

The old security issues with PHP were if you used SQL strings queries without sanitizing user input, or using eval or a bad configured server where someone could upload a file and had it be executed.

So you can use PHP without a framework, you need a good configured server, use the correct SQL related functions and practices.

Example for a project you have a third party payment system that can send you a POST request when an event happens, you want to log this event in the database and maybe trigger a simple thing. I can(and done this) with just 1 PHP file, no third party dependencies and I did not had to install anything on the server(because PHP is already there) so no installing node,npm,npm packages maybe git .

You will need a framework if you have a big project, you would be wasting a lot of time to do the logins, user management, view rendering from scratch and probably have a lot of bugs. There are minimalistic frameworks and libraries and you can use something that matches your need.

Re: PHP in 2019

#66
post #49

Earlier quoted context omitted.

I think the point is that if you use a "new mainstream framework", you lose the traditional unique strengths of PHP by using it essentially the same way as you would any other language, so you might as well use a different language. So instead of trying to be like other languages but with worse syntax and weird quirks, PHP could try to improve on the things that make it different and lead to its initial popularity.

Exactly my point. Thanks for explaining it much better than I could.

Your point as related to security, so mention what security problems are in modern PHP and frameworks.

Re: PHP in 2019

#68
post #51

As far as I'm concerned the bridges have burned a long time ago and I definitely can't see myself giving PHP a second chance. That being said, if I'm wrong and PHP has really managed to become a decent language (or at least something that's not completely insane) its defenders should focus on actually showing what modern PHP code looks like. Is performance that much of a big deal for most people? In a world where Rub…

Agreed, articles like these do absolutely nothing to address PHP's insane warts, some of which you mentioned.

That's not helpful. Laravel can objectively be the best web app framework in the world and I still won't touch it, because of PHP.

Predictability, minimum WTFs per minute, consistency, sane defaults -- these win over short-term convenience, every time.

Re: PHP in 2019

#69
post #36

Earlier quoted context omitted.

> Won't your prototyping be faster in Go/Python/Node/Ruby anyway, with a more stable surface to build upon it? One of the most understated pros of PHP (IMHO) is that it's so easy to get setup with. You can start hacking on something so quickly. In my experience, Go has not been like that. Node.js also was never as quick.

Not really the case with Docker. I can spin up a container targeting any language in less than 10 seconds, mount a volume and start hacking away. Best of all, it doesn't pollute my system in any way. We shouldn't pick a language just by how easy it is to get started, a decision which often leads to a lot of regrets. Pick whatever is good for the project not your disposition.

But I am productive with PHP, I don't know docker or related tool chains, I am more productive in PHP then Python(because of my own experience and dilikes for Python like syntax), the ecosystems are equivalent for my task so I would use PHP. Buf if PHP was not good enough then sure I would always use the best task for the job(I used Java for a different project or even use a bash script and pipe UNIX tools)

Re: PHP in 2019

#70

The thing that matters is language consistency... A language with a pure clean vision of itself in which the programmer can guess at syntax because they understand the general syntax principles to which the language adheres. Nothing here says PHP has been fixed in this regard. Python made the big leap and fixed some huge problems when it went to python 3 - yes it's migration approach was a total fail, but it further…

That would break too much things and the benefits will not be enough. They could add some new things, deprecated the old things and keep them all but then you get a manual twice as big. All the changes in PHP feel pragmatic, like better SQL support, better cryptography support, better defaults, better performance and less on cool looking syntax or latest cool features. IMO pragmatic is good, especially when you have…

I don't disagree with your points -- but then it turns out that PHP is still the same old crappy language it was ten years ago.
Post reply on HN