Live data from Hacker News

We Don't Hate PHP

hologram.io

71–80 of 85 posts

Re: We Don't Hate PHP

#71
post #68
post #33

Earlier quoted context omitted.

Python isn't a framework, but in contrast to Pythom, PHP made some bad decisions that are hard to roll back, the biggest being cramming hundreds of inconsistently named standard library functions into the default namespace. PHP can be very productive but I think it's fair to day it was designed a lot less intentionally than many languages.

PHP is very guilty of cramming hundreds of inconsistently named standard library functions into the default namespace, but I wasn't aware of Python doing this?

Wrote the opposite of what I meant. Thanks for pointing it out while I can still edit :)

Re: We Don't Hate PHP

#74
post #52

This is such a surface-level article. Most of the things listed as advantages exist in other languages as well. Here are some actual reasons to like PHP: 1. Java-like interfaces and classes and strict argument (and soon parameter) typing enforced at runtime 2. Autoloading and "lazy loading" of classes means defining bi-directional relationships between classes/types is painless (this can of course also make you shoot…

Hey, really good list, better than the article. I don't really like PHP, because of inconsistency (it tends to break to flow for me) (but maybe it changed since 2014), but php with strict typing is a big plus for me and php7 is already more than fast enough. I might try it again. The real issue i have with PHP is frameworks :/ Too much choice is a productivity killer for me.

Compared to what language? I don't think PHP frameworks are very different from other languages I've played with.

Here's my framework guide: Slim if you're a minimalist and like doing things yourself, Laravel if you like convenience and are a quick learner, Symfony if you want to build something that will last 5+ years.

Re: We Don't Hate PHP

#75
post #50

This is such a surface-level article. Most of the things listed as advantages exist in other languages as well. Here are some actual reasons to like PHP: 1. Java-like interfaces and classes and strict argument (and soon parameter) typing enforced at runtime 2. Autoloading and "lazy loading" of classes means defining bi-directional relationships between classes/types is painless (this can of course also make you shoot…

> you may disagree with some of the things I listed if you don't like the particular feature or design, but that doesn't make them not advantages Since the above equally applies to you, I suppose you're saying that these "advantages" are a matter of opinion.

You're right, probably the word advantage was a bad choice here.

The point I wanted to make was that you might disagree with a certain feature/design but that doesn't make them invalid reasons for someone else who likes them to see them as advantages.

Re: We Don't Hate PHP

#76

After reading the PDO section, I started to wonder if the author has used a language other than PHP. How can PHP have the best database integration if the best example you can show are simple prepared statements?

"Best" is subjective, though, isn't it? What do you regard as being better? Personally I hate frameworks like Zend which abstract database operations into multi-parameter functions. It serves very little purpose when you can just write actual SQL, in my opinion.

Re: We Don't Hate PHP

#77
post #41

Earlier quoted context omitted.

Exactly. I’d argue what makes modern PHP less awful is almost entirely in what it lacks . Checking a bunch of random OOP boxes is not going to make it a good language. People love plenty of programming languages that don’t check those boxes. (Lua, C, Go are all languages that lack many of those OOP features, for example.) And to be sure, modern PHP is better. The beginnings of typing, the fixing of horrible standard…

> And it’s tricky to dockerize a PHP app effectively since you typically need multiple processes; Absolutely. I handle a lot of the devops work at my job and PHP containers are just all around more annoying to build, configure and run than most other languages. Even on modern frameworks like Laravel still have a lot of default assumptions of being hosted on a server all by themselves. It's weird how a language that g…

It is fairly simple to host, as long as you run on a single machine. (Host volume mount in Docker for eg).

Re: We Don't Hate PHP

#78
post #48

Earlier quoted context omitted.

What makes Laravel so good and why can't we clone to a framework in say Python?

I'd say Laravel is a younger, clumsier Rails, based on personal experience of Laravel and having casually watched Rails evolve from the sidelines. I don't think any Python folks would bother to clone it as most of what it does already has better answers in the Python world. For example, SQLAlchemy is amazing, and I'd never willingly swap it for Laravel's ActiveRecord implementation. To be clear, I definitely prefer P…

Laravel has had features before Rails ActiveQueue(?) for eg was adopted in Rails core a few years after Laravel had a stable Queuing system. Rails delegated to Sideqik for long and that caused issues for the ecosystem.

Re: We Don't Hate PHP

#79
post #21

Is PHP still hated on a lot these days? Isn't it just not that popular an option anymore to start new projects with? Most people are aware of the language having changed a lot since its heydays. And honestly, from the article I'm not quite sure why I should consider using PHP. Sure, it has a lot of modern bells and whistles now that it didn't when I last used it 2005-ish, but what makes it stand out? I know a number…

The more experience I get, the more I think that most languages are just fine. Coding is increasingly the easiest part of my job. I’d work in PHP if needed. But I’m still not touching MUMPS.

> The more experience I get, the more I think that most languages are just fine.

Quite. Just give me a boring language with a stable ecosystem, mature and extensive tooling and fully understood quirks. That means all the time and effort can be spent building the actual product instead of burning time monkeying around with the shiny-new language.

This means that things like Java and PHP (and C in some domains) are nearly universally the correct answer if your goal is to build a product instead of building a resume.

Re: We Don't Hate PHP

#80
post #76

After reading the PDO section, I started to wonder if the author has used a language other than PHP. How can PHP have the best database integration if the best example you can show are simple prepared statements?

"Best" is subjective, though, isn't it? What do you regard as being better? Personally I hate frameworks like Zend which abstract database operations into multi-parameter functions. It serves very little purpose when you can just write actual SQL, in my opinion.

I'm sure that a lot of other people have great experiences with other database interfaces such as C#'s Linq or Ruby's ActiveRecord, but that really isn't the point of my comment. The PHP snippet in the article is pretty much the bare minimum for SQL integration in other languages. As another reply to my comment points out, the PHP snippet posted is nearly identical to Perl's DBI (which I believe PDO is based on), which came out 1995!

For an article that purports "PHP is good now", I wouldn't expect one of the selling points to be something that could be done in (and is routinely done), in Python/Perl/Ruby for over 25 years now.

Post reply on HN