Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

161–170 of 468 posts

Re: PHP is worth learning and using

#161
PHP is a lot better. But it still has a lot of the same old issues when you look beneath the service. Good luck remembering what all the str* functions they invented do and what order their arguments are in. Same for the array functions (don't get me started on implode's three signatures - but that's mostly fixed in 8!).

And may His Noodly Appendages help you if you come across a function being used which has no documentation and a single decade-old comment from someone asking how it works...

And so, to plaster over it's many flaws, people start layering framework upon framework upon framework, each of which slows down the language significantly from all those shiny PHP performance benchmarks you see. And then they wonder why their shiny "what's an array? we need to transit 20 different chained method calls for that" is so slow...

And half of them are documented even more poorly than PHP itself. At least their code is in the same language you're already writing, though.

Re: PHP is worth learning and using

#162

Earlier quoted context omitted.

R is another language that it is bashed constantly, but it is generally much productive in its field (EDA and stats on structured data) than the alternatives like Python.

This. While I'm not sure I'd build a website or something with R, for pretty much anything data related R is a first choice. Even for big data on clusters or something. It's absolutely amazing at what it does. Super easy Fortran and C++ interop. Bonus that it's well enough known in academia and fields like statistics or economics.

I'm not sure I'd build a website or something with R

Have you played with Shiny (shiny.rstudio.com). If you're building a website for interactive data exploration and analysis, it is very hard to beat.

Re: PHP is worth learning and using

#163
Most arguments against PHP miss the point. You know why you should use PHP? Because it's fun and you can get something running much quicker than figuring out the Elixir, Ruby, Rust, whatever ecosystem and paradigm. Maybe PHP is not so good at WebSockets or async worker threads, but most projects don't need that. There's no shame in doing long polling, users can't tell the difference anyway!

PHP shines when you're trying to get a server-rendered web app off the ground. It's the VB6 of the web. Nothing else matches its development velocity, from keyboard to working code.

Re: PHP is worth learning and using

#164

Hmmm... Most points in this article are shouting "yeah we have those too!!" but it didn't give any convincing arguments why I (or anybody who doesn't already know PHP) would like to learn and use PHP over other decent modern languages and ecosystems, which happen to have those points as well.

The best part of PHP is the development model. You copy some files to a server, and load the page. That's it. It is really hard to beat how easy it is to iterate, even if the language is truly terrible.

I don't see how that makes the development cycle any better. I can just edit a file, press save, and it compiles and tests run automatically. If I'm doing something in interpreted languages, the code updates in memory.

Furthermore if I'm working with JS/TS, hot reloading even makes it so I don't even need to refresh the page. I can even inject code into arbitrary places with the debugger (as if I'm editing the source)!

So, all these other ecosystems are on par with the PHP...

I'm glad PHP adopting ideas from other communities, and that the community is becoming more cohesive, though.

Aside: I used to write PHP before (back in the 3 to 5 days), and worked for a big web hosting provider that had a big shared hosting customer base; PHP was by far the most popular technology in that space.So, I'm not trying to bash on PHP.

Re: PHP is worth learning and using

#165

Earlier quoted context omitted.

Why would you pick any other language instead of PHP for web dev?

Because Elixir has transparent parallelism and trivially scales to 2000 reqs/second on a $5 VPS even though it's a dynamic language, oh and because it has LiveView which eliminates the need for most of the JS in a project (if latency isn't critical), so now a backender can take care of 100% of a web project. I worked with PHP 9-10 years ago. Still not impressed to this day. Why should I use it? Terrible type coercion…

If you're happy with Elixir, just use Elixir.

But companies might want to use PHP, because it has a rich ecosystem, which handles corner cases.

Chances are, if you want to send out bulk email, or connect to a payment provider, there's going to be a library in PHP that allows you to do that, often with long term support from an agency.

A corner-case I recently had was needing to decode an email. There's a function for that: quoted_printable_decode. This is a common situation for PHP. If you have some sort of issue around the web, there's likely to be a PHP solution.

And if you're a small business that needs a bit of bespoke software written, then you can easily hire someone, and know a decade later, you'll be able to hire someone if the requirements change.

Much of this can also be said of the Java ecosystem.

Just recently, I was using a small business that managed their bespoke business process built on a PHP CMS. They don't need 2000 reqs/second.

Re: PHP is worth learning and using

#166
post #91

Earlier quoted context omitted.

It depends on what you want to do. The problem is that PHP is hyper-optimised for serving up HTTP. That was great in the 2000s when the web was eating the world and the other options were Java, Python, and Perl, but is less useful in the current climate where there's so many more platforms and web development requires javascript. By learning PHP, you are effectively locking yourself into the narrow niche of backend w…

Best since everyone is thinking along the same lines Javascript/Python/Go developers are quickly becoming a commodity; e.g there are millions or tens of millions of developers who learn them as their 1st language (many of them are now hirable remotely). Just worth noting I think...

From brutal experience I can tell you that's also been true for PHP programmers for a long time.

Re: PHP is worth learning and using

#167
post #62

Promoting php is truly a head in the sand attitude. Yes there is valuable old software, but come on. Move on if you don’t have to touch it. Stop being oblivious and rejecting advances in programming language design. That probably goes to a lot of other languages too.

what's new in programming language theory since the 70s?

Re: PHP is worth learning and using

#168

Hmmm... Most points in this article are shouting "yeah we have those too!!" but it didn't give any convincing arguments why I (or anybody who doesn't already know PHP) would like to learn and use PHP over other decent modern languages and ecosystems, which happen to have those points as well.

The best part of PHP is the development model. You copy some files to a server, and load the page. That's it. It is really hard to beat how easy it is to iterate, even if the language is truly terrible.

I have seen people deploy php this way but I'm not aware of anyone who'd do it today.

Locally however it is save, alt-tab, ctrl-r and immediately you see the result. Absolutely no waiting.

These days I rather use Quarkus for this but until Quarkus arrived this was a huge advantage that PHP had over every other language and framework I was aware of.

Also the documentation was fantastic compared to most of the stuff I have had to suffer through on Java, .Net and even React and Angular.

Every thing you may reasonably wonder about was described in a clear, straight forward way and included examples.

Re: PHP is worth learning and using

#169

Earlier quoted context omitted.

Why would you pick any other language instead of PHP for web dev?

Because Elixir has transparent parallelism and trivially scales to 2000 reqs/second on a $5 VPS even though it's a dynamic language, oh and because it has LiveView which eliminates the need for most of the JS in a project (if latency isn't critical), so now a backender can take care of 100% of a web project. I worked with PHP 9-10 years ago. Still not impressed to this day. Why should I use it? Terrible type coercion…

I haven't worked in PHP for years but 2000request/second doesn't sound unreasonable for PHP either?

And that with a language that everyone can use.

Re: PHP is worth learning and using

#170

Hmmm... Most points in this article are shouting "yeah we have those too!!" but it didn't give any convincing arguments why I (or anybody who doesn't already know PHP) would like to learn and use PHP over other decent modern languages and ecosystems, which happen to have those points as well.

> use PHP over other decent modern languages and ecosystems

There's not a lot that is comparable to the PHP ecosystem when it comes to bespoke web-based e-commerce, or anything to do with bespoke customer or content management.

If you're trying to integrate with some weird 3rd party API, chances are there's going to be something written in PHP, or you can easily pay someone to do it for you.

Not only this, but there are agencies providing long-term support for parts of this ecosystem.

Other languages with strong ecosystems in this area would be Java, or Ruby, I think. I like Java for the same reason, and would probably like Rails. Anything that has "batteries included" is good to me.

Post reply on HN