News for hackers. Stuff that matters.
Re:PHP 8: Before and After by pietrovismara on Friday October 23, 2020 @03:16AM (#24866810)
Seriously, enough with PHP. Can we just let it die?

I worked with PHP 5.6 years ago and I hated it.

Recently I worked with PHP 7. Heard about all the work that's been done on it and I was kinda excited to try it. It's still so broken. It doesn't matter if they improve performance or add new cool features. PHP is broken in ways that can't be fixed without breaking compatibility. Fork it or put it out of its pain.

Re:PHP 8: Before and After by 0xy on Friday October 23, 2020 @03:31AM (#24866886)
This is such a shallow elitist comment. A lot of the common criticisms levied at PHP have been corrected years ago, and PHP is responsible for hundreds of billions of dollars of turnover globally.

Of the top 10 websites in the world, PHP is partially or wholly powering more than half of them. Wikipedia, Wordpress, online retail.

I have personally created 6 figures of value because I could quickly dump some PHP scripts on a VPS server and start doing business.

My employer makes billions with PHP. It's not perfect, but it's rock solid for gigantic businesses.

Sure you can build yourself perfect shiny web services using modern bleeding edge languages, meanwhile businesses using PHP for decades are innovating and printing money daily.

Re:PHP 8: Before and After by pietrovismara on Friday October 23, 2020 @04:01AM (#24867052)
How can you call this elitism? Nobody forces you to learn PHP, you can learn any of the many other open source existing languages. There's no gatekeeping preventing you from learning languages other than PHP.

I'm just calling it for what it is: a broken tool. I'm suggesting we let go of this broken tool and focus on tools that already work great, instead of wasting millions of human work hours on sub-par coding. Sure, you can still make billions with broken tools, but you could also have done that more easily with the right tools.

Re:PHP 8: Before and After by 0xy on Friday October 23, 2020 @09:07AM (#24869059)
I've seen companies decimated by refactors to new shiny technology. Security, scalability and ease-of-use is practically solved in PHP.

PHP is inherently stateless, making it easy to scale up. Facebook has had pretty close to a 100% availability rate since launch and PHP is still responsible for large swathes of their functionality.

Most people attacking PHP read a snarky article written in 2012 about PHP's limitations and cannot actually provide reasoning for why it's so awful.

Wikipedia, huge portions of online retail, forums and Facebook. Are these things inherently less secure or available than companies with a "modern" stack? Not really, in fact pretty much the opposite.

I'll let you in on a little secret: your customers could not care less about your shiny modern stack. As long as it's not preventing performance, security and new development then they don't care.

My PHP endpoints respond in <100ms, which to my customers is perceptionally instantaneous. They wouldn't benefit from any shiny modern language at all (but I do use them).

Re:PHP 8: Before and After by nix23 on Friday October 23, 2020 @06:13AM (#24867820)
>I'm just calling it for what it is: a broken tool.

Thats what every Rust-Fanboy says about the C/C++ Ecosystem

Re:PHP 8: Before and After by codegeek on Friday October 23, 2020 @04:40AM (#24867239)
Why is it a broken tool ?
Re:PHP 8: Before and After by oblio on Friday October 23, 2020 @04:43AM (#24867256)
VBA or Excel formulas are responsible for at least as much.

They're actually great technologies, but for a very specific scope. Once you're outside of that strictly restricted scope, they're objectively horrible from an engineering point of view. The standard example is building a database with Excel + formulas.

There is a point in this whole thing. Some technologies should whither and disappear, slowly, over time, so that better one can take over. Or they should remain in their very narrow niches. For PHP I'd venture that it should remain a language for hobbyists creating personal home pages.

Related to this, standard, fixed column, steering wheels also were probably responsible for hundreds of billions of dollars of turnover globally.

But I'd still want my car to have a telescopic steering wheel, airbags, and all the modern safety features you find in a car.

The old school fixed column steering wheel should only be seen in museums or in classic cars out on the road with a special license.

Re:PHP 8: Before and After by nucleardog on Friday October 23, 2020 @03:46AM (#24866979)
One of our acquisitions was one guy with no real background in tech working over a few years in his spare time and turning a project into a multi-million dollar business competing well against other entries in the market put together by teams of a dozen or more actual developers with millions in VC funding.

And that was a project originally targeting PHP 4 and, by the time I was brought on, had made it all the way up to 5.x.

I mean, yeah, the code is garbage, but if he weren't allowed to write garbage code _he just wouldn't have written the code at all_. If that guy had to sit and learn proper paradigms and server administration and a bunch of other stuff, he would have just gone out and done something else instead.

Yeah, PHP lets you write shitty code (though it also lets you write _good_ code...). But in lowering the barrier to entry as it does, it also lets people who don't know how to write great code turn their ideas into reality. Unlike the suggestion of another comment, I've got a great deal of experience with "saner" languages, but despite PHP getting a bad rap because of its low barrier to entry I still admire PHP as a great equalizer.

Re:PHP 8: Before and After by throw_m239339 on Friday October 23, 2020 @03:36AM (#24866918)
> This is such a shallow elitist comment. A lot of the common criticisms levied at PHP have been corrected years ago, and PHP is responsible for hundreds of billions of dollars of turnover globally.

So does Java, Python, C and C++. This is also a shallow argument. No language is perfect but PHP still suffer from the same design issues a 10/15 years ago, none of them have been correct and it's perfectly valid to point that out.

> My employer makes billions with PHP. It's not perfect, but it's rock solid for gigantic businesses.

And with C, since PHP is written in C and probably whatever fronts your PHP applications, and with Javascript because you sure ain't running PHP on the client and so on and so forth...

Re:PHP 8: Before and After by jonwinstanley on Friday October 23, 2020 @03:41AM (#24866954)
PHP is a great fit for the web, always will be. There are “better” languages and solutions but they are usually more difficult to setup or not as easy to learn.
Re:PHP 8: Before and After by ptx on Friday October 23, 2020 @04:45AM (#24867272)
How is it a great fit for the web, compared to other languages? All its unique strengths (in this very narrow context) are being phased out:

1) It used to be loaded straight into the Apache process as a module, which made it very convenient to get started with but required terrible broken hacks to run multiple applications/users separated from each other in a secure way. But nowadays people are switching to PHP-FPM, which is the same approach used by Python, Java and most other languages.

2) Every possible extension baked right into the language as a global function instead of using namespaces and a package manager like other languages. But nowadays people use namespaces and a package manager, just like in other languages.

3) Templating as part of the core language (in fact the core language is a templating language) so you don't need a separate templating library like in other languages. But nowadays people use separate templating libraries, just like in other languages.

Re:PHP 8: Before and After by francislavoie on Friday October 23, 2020 @08:42PM (#24875918)
> But nowadays people are switching to PHP-FPM, which is the same approach used by Python, Java and most other languages.

What? Not even close. You can update PHP code by just replacing the files, it's not compiled. PHP-FPM is just a layer that provides a fastcgi interface and manages processes that run PHP. It's super easy to run, super easy to proxy to with Caddy or Nginx or whatever else support fastcgi.

Java is compiled, and typically runs its own HTTP server. Python is not compiled, but usually it runs its own HTTP server, or a WSGI server which adds another layer.

> Every possible extension baked right into the language as a global function instead of using namespaces and a package manager like other languages.

Are you trying to say that global functions are a strength? Namespaces are a big improvement. Many modern PHP extensions provide namespaced classes now, it's mainly the older ones that don't.

Re:PHP 8: Before and After by throw_m239339 on Friday October 23, 2020 @03:48AM (#24866998)
> PHP is a great fit for the web, always will be. There are “better” languages and solutions but they are usually more difficult to setup or not as easy to learn.

Talking about shallow comment you could say that from dozens of languages that have saner foundations.

> There are “better” languages and solutions but they are usually more difficult to setup or not as easy to learn.

No they are not more difficult to set up, not in the era of containers and PAAS. Of course if you still rely on Go Daddy for hosting, it might be...

Re:PHP 8: Before and After by throw_m239339 on Friday October 23, 2020 @03:33AM (#24866904)
Well it's still broken because the broken stuff was never removed, PHP just added new some stuff on top of it. Typing is neat though, but no generics, no private classes/packages so you get the worst of Java "enterprise" OO on top of some dubious language foundations.
Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @03:28AM (#24866872)
I have worked with PHP for years, and I agree completely. I think the people who defend PHP either have too much invested in it, or they have never gotten productive in a saner language. Or both.
Re:PHP 8: Before and After by spiderfarmer on Friday October 23, 2020 @03:34AM (#24866912)
The people who invested "too much" in it don't have to defend it. They'll simply continue using it. They'll enjoy the new functionality. If I make millions upon millions of revenue with a PHP application, I don't care if tech nerds dislike the syntax used to build it.
Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @03:37AM (#24866924)
Syntax is very far down the list of problems with PHP
Re:PHP 8: Before and After by admissionsguy on Friday October 23, 2020 @04:03AM (#24867060)
> list of problems with PHP

(Here we go again.) Such us?

Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @05:03AM (#24867361)
Are you productive in any of the following? C#, Ruby, Rust, Elixir, Typescript (or even Haskell)

If not, you're just proving my original point. It's hard to see the problems of a language if you are only productive in that language. I can start pointing out flaws in PHP, and you can claim that those flaws don't matter. Until you increase the number of languages in your repertoire, our discussion about the flaws of PHP won't be constructive.

Re:PHP 8: Before and After by dcabrejas on Friday October 23, 2020 @09:50AM (#24869449)
I think arguments against PHP could be make against many other languages, ie: Javascript or python. But they are not done as much and I think this indicates that people make those arguments in bad faith.

If we say once a better language comes along, we should say that the old language is shit and should die, then sure keep doing that. But looking at the languages that you have listed above, none of them are dynamically type I belive although not familiar with a couple of them. For some small projects people might prefer dynamic typing, or if you are prototyping something.

Also the amount of libraries, frameworks and projects already written PHP is massive so if someone wants to do something fast, why limit people's choices by trying to convince everyone that the language is shit instead of letting people decide for themselves? It just feels like a witch hunt to me.

Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @09:59AM (#24869543)
Are you productive in any other language than PHP?
Re:PHP 8: Before and After by dcabrejas on Friday October 23, 2020 @10:15AM (#24869718)
Alright, if that's the filter people need to pass before you listen to their arguments then I'll tell you the list of languages I am productive in:

Javascript, PHP, Haskell, Rust, C++ and LISP. I'm familiar with the benefits and drawbacks of all of them and I don't see how any of them replaces PHP

Re:PHP 8: Before and After by admissionsguy on Friday October 23, 2020 @11:20AM (#24870401)
I dislike the patronising tone of your comment. If your first assumption is that the interlocutor is monolingual, that makes me think you are used to a quite unsophisticated company.

> I can start pointing out flaws in PHP, and you can claim that those flaws don't matter.

It is context-dependent. For some jobs it is a poor choice, for others - including most of web application back-end development - pretty much none of its so-called flaws actually matter.

Re:PHP 8: Before and After by spiderfarmer on Friday October 23, 2020 @03:42AM (#24866959)
And even those problems are very far down the line if the business logic results in the expected revenue.
Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @03:48AM (#24866992)
Finding talented developers that want to work on your codebase is a factor in your example. More and more developers are realising they don't want to work with PHP. How much revenue will you get without developers?

Go ahead, keep using PHP for your existing multi million dollar product. But using PHP for new projects is not wise.

Re:PHP 8: Before and After by echelon on Friday October 23, 2020 @03:55AM (#24867021)
Recruiting emails from companies that use PHP go straight to trash. Wouldn't even consider it, and I know I'm not alone.

PHP shops won't attract from the same pool of talent. It's not that there aren't good PHP developers, it's that there are so many brilliant engineers that are never going to consider such work.

Languages matter.

Re:PHP 8: Before and After by codegeek on Friday October 23, 2020 @05:02AM (#24867355)
Good for you but I don't hire language developers for my company. I hire developers who care about solving problems, no disrespect meant to you. Today it's PHP, tomorrow we could do Golang etc etc. Who cares. When I interview a developer, I pay attention to the fact if they are too obsessed with a certain language instead of real problem solving. My 2 cents.
Re:PHP 8: Before and After by awestroke on Friday October 23, 2020 @05:03AM (#24867364)
The developers care.
Re:PHP 8: Before and After by codegeek on Friday October 23, 2020 @05:26AM (#24867516)
We can agree to disagree. Plenty of great developers work with PHP.
Re:PHP 8: Before and After by spiderfarmer on Friday October 23, 2020 @04:49PM (#24873992)
Using PHP is a great way to keep snobby developers at bay.
Re:PHP 8: Before and After by AdrianB1 on Friday October 23, 2020 @04:41AM (#24867247)
I use PHP for scripting in Windows, a saner language is not needed for that, in many ways PHP is saner than scripting options included in Windows. It is a good enough product for that job. I can also quickly create a few minimalistic web pages to simplify some of my work, the other languages are an overkill in most of my use cases. There are other reasons to use PHP than what you listed.
Re:PHP 8: Before and After by simion314 on Friday October 23, 2020 @03:34AM (#24866914)
Most of the bugs or spaghetti code I have to fix this days are not caused by the language, the issue is most of the time the requirements that changed or the developer was not experienced with that certain problem so he created a monster.
Re:PHP 8: Before and After by cute_boi on Friday October 23, 2020 @05:10AM (#24867411)
its like saying most of the seg fault caused is not due to use of C. Common langauge pattern / design choices made php to have bugs/ spaghetti code. At the end developer control many thing but that doesn't mean language don't have any fault.
Re:PHP 8: Before and After by simion314 on Friday October 23, 2020 @06:19AM (#24867873)
It is not fair to bring C into this, C is an old language and when all the kernels and core libraries were created it was the best tool for the job. You hate C please go and contribute to the many rewrites and one day 25 years from now maybe we will have an OS written in some language that is cool now but would be outdated then.

My advice is use the best tool for the job when possible, if you don't have a choice then learn to accept that most of us work with less cool languages/frameworks/projects ... the skill we bring is to find solutions for our customers and implement this solutions as best we can with the tools we have, most of the time a developer should be spending reading stuff(documentation,articles, code), thinking and the least time should be spent on typing code or tooling.

Re:PHP 8: Before and After by giantDinosaur on Friday October 23, 2020 @07:10AM (#24868205)
If we want to really reduce typing we should make everyone program in Haskell (and start a national effort to improve its tooling) ;)
Re:PHP 8: Before and After by simion314 on Friday October 23, 2020 @07:51AM (#24868463)
I think you misunderstand me , my point is think more and type less. Is not about clever one liners or languages with less verbosity but better implementations and abstractions and you can implement a good solution in a lot of languages.

An example would be where a dev needs to implement X, then he goes on Google , finds some code sample , copy-pastes it, tests it, then changes here and there to make it work. The issue is that he maybe forgot to read the documentation for the functions used in the sample, or did not think that the sample is incomplete (maybe missinfg input sanitation) or is outdated or the solution was already in the project code if he only have asked or looked around in the code.

Other example is when a dev wants to solve X, installs a package from npm that does X but does not understand it and in fact that npm package is just a few lines of code that you could have read, learn something, find limitations and improve that.

Re:PHP 8: Before and After by joseluisq on Friday October 23, 2020 @03:38AM (#24866930)
Yeah, as another user has said, PHP is getting "cooler" (do you get it?). However not only because it is turning into a sort of "Java-like" is will be get heater again. PHP is fine for its stuff on FastCGI but more further than that, I don't think so, sorry. There are many of programming language alternatives out there.
Re:PHP 8: Before and After by AdrianB1 on Friday October 23, 2020 @03:18AM (#24866822)
Live and let live. There is enough space in this Universe for you and PHP to coexist without interacting, if you don't like it then ignore it.
Re:PHP 8: Before and After by pietrovismara on Friday October 23, 2020 @04:05AM (#24867073)
Yeah that's mostly true, at least until you get a new job and only a few weeks in you find out they have a "small" years old service written in PHP that no one else wants to maintain :)

That's my story, I ignored PHP for years but since I had to work again on it recently and got pretty quickly hit by its "rough edges" I couldn't help but ask myself why such a bad language is still around.

Re:PHP 8: Before and After by Mikushi on Friday October 23, 2020 @06:44AM (#24868050)
Because unlike "good" languages it generates revenue.
Re:PHP 8: Before and After by sschueller on Friday October 23, 2020 @03:25AM (#24866850)
The day you reach perfection is the day you finish your project as in never...

PHP works (thought not perfect) lets me get things done.

Re:PHP 8: Before and After by ptx on Friday October 23, 2020 @03:45AM (#24866975)
Lots of languages work and let you get things done. You don't have to choose PHP.
Re:PHP 8: Before and After by joseluisq on Friday October 23, 2020 @03:59AM (#24867043)
Yeah, It's because certain devs instead of adopting a defensive position in favor of PHP. They don't think in the fact that there are many alternatives of programming languages even superior than PHP for different use cases and exigencies. E.g Lua, Julia, Erlang, Python, even the slow Ruby just to name few of them.
Re:PHP 8: Before and After by codegeek on Friday October 23, 2020 @04:59AM (#24867335)
"Lua, Julia, Erlang"

For most CRUD web development, using Lua/Julia/Erlang has a heavy cost upfront of learning, finding developers and many other issues like hosting etc. PHP works out of the box on most servers and has a mature ecosytem. So this is why I cannot just get into Lua or Julia because it is much better than PHP. It is all about cost vs benefit analysis. Sure, if I am building something like whatsapp, I should probably learn Erlang over PHP but if I am building yet another CRUD App (which most web apps are even in 2020), I am totally ok with PHP since that gives me the quickest and most mature way to get started.

People who care too much about languages remind me of the "If you have a hammer, everything looks like a nail" situation. Not every application has to be built in Julia/Lua/Rust whatever.

Re:PHP 8: Before and After by ptx on Friday October 23, 2020 @01:53PM (#24872046)
Are you arguing that PHP is the quickest way to get started in the case where you already know PHP but not any other language, i.e. writing a program in PHP compared to learning another language from scratch and then writing the same program in that language?

That's probably true. But if PHP is the only language you know, it might still be worthwhile to learn another one, when you have some time to spare.

And "most mature"? Other web frameworks are plenty mature. Django, Rails and Spring MVC are all roughly 15 years old.

Re:PHP 8: Before and After by codegeek on Friday October 23, 2020 @04:52AM (#24867297)
PHP lets you get things done. You don't have to choose another language.