Hacker News new | ask | show | jobs
by duaneb 4349 days ago
> PHP is quite a capable language

I don't think anyone is complaining that it's not turing complete (or whatever), it's all the times php has dropped the ball in the std library, both with respect to being consistent with itself and just being plain broken. I don't think any sane person would switch from a language INTO php, given how many languages that are just as capable as php without having all of its various historical burdens (sigils, stdlib, mediocre type system).

3 comments

Amen. I think this thread could use a little: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

It has never been about whether PHP can get shit done, it's that given languages that actually had formal design processes and make your days as a coder a joy, why would you move TO PHP.

There are simply so many other options.

There are many other options, none of which enjoy the ubiquity of PHP (as far as being installed on such a vast majority of hosts).

The barrier to entry is higher if you want to run a site on something else.

That is the sole reason PHP is as popular as it is and part of the reason why it stays popular and powers so many of the internet's top websites.

Other reasons why it stays popular is that they really have improved it a lot over the years and knowledge on how to run PHP at scale is quite easily available. The community is improving along with the language.

Yes, the standard library is frustrating but that is a pretty minor inconvenience honestly. Every language has a frustrating part of its design. This wart on PHP can be fixed and there are some great recommendations on how to transition to a better std lib in other comments on this OP.

> There are many other options, none of which enjoy the ubiquity of PHP (as far as being installed on such a vast majority of hosts).

What is this really an issue for? I mean, sure, there may be more choices of low-cost low-feature shared hosts that support PHP than other languages, but its hardly as if there aren't a sufficient quantity of low-cost (even, in some cases, with free tiers) platforms for apps in a wide variety of languages.

Unless you are literally compelled to choose a host at random, the fact that a randomly-chosen shared host is more likely to support PHP shouldn't really matter.

> none of which enjoy the ubiquity of PHP (as far as being installed on such a vast majority of hosts).

So, choose the language based on the ease of the first 15 minutes of your startup?

I could say it worked pretty well for Facebook but that would be too easy. Seriously though, I know it is very in vogue to hate PHP or at least favor X language over PHP and has been for a long time. I'm not trying to sell you on the idea that PHP is objectively the best language or even a "good" language. That is beside the point I'm trying to make which is that it literally (still) powers the majority of the internets' websites. Tons of new websites are still being made using PHP and THAT is a tough pill to swallow for many people of the opinion that it has no merit.

I don't personally enjoy programming in PHP but the way people act as if it isn't massively important strikes me as obtuse and/or petty.

I think that depends on whether an individual can get past that first 15 minutes. Me, I can have a virtual host running anything I want in a couple of minutes. You too, I'm sure. But for people who aren't pros, just getting something hosted can be a major battle. Not as major as when PHP got its start, but it's still too hard.

That's the lesson I'd love to see other ecosystems learn. PHP, by being very novice-friendly, has developed an enormous user base. How much better off would those people be if they had started with a language that was awesome not just for starting, but for the long term?

(As an aside, I'm throwing no stones here. My first programming language was BASIC, and it took me a long time to unlearn the bad habits it gave me.)

I'm talking about people who need websites in general. Not your fancy startup. Also please name me a single startup that for some reason could not flourish using PHP as opposed to some other language?

It's really more about the talent of your team than the language you choose to write your app(s) in.

> It's really more about the talent of your team than the language you choose to write your app(s) in.

If you have a talented team, why on earth did you choose PHP?

It's too bad to see that your comment was voted down. It's a legitimate question, deserving of an answer.

It isn't the late 1990s any longer. Perl and PHP aren't the only viable options available for web development. We have more alternatives now than ever before.

It was one thing when a team chose to use PHP because it was all that their preferred hosting provider supported, for instance, but those days are long gone. There really is very little reason to use PHP these days, especially for new development.

If you slog through that, might as well read the rebuttal http://forums.devshed.com/php-development-5/php-fractal-bad-...
The PHP Bad Fractal Design article is The Godwin's Law of PHP programming discussions.
For me this is the important part.

I have a team with java/php/javascript experience. PHP will not be an option for my use case. I need a json based rest interface with a decently discoverable web interface. Java has stupidly powerful rest interface libraries with jersey or full application servers, and javascript has hugely powerful frontend interfaces with angular or other frameworks, based on a strong rest interface. And the strong rest interface goes right back at java.

And we are just a limited team with java* experience. I don't know what teams with django or other twisted libraries will do, or what ruby shops will do. The era of "just make it easy to print html" is gone.

Dingo for Laravel might be worth a look for you.

https://github.com/dingo/api

edit: I misunderstood your post I think.. But if you're looking to generate APIs, Dingo is still worth a look just for reference.. :-)

>I need a json based rest interface with a decently discoverable web interface.

php has apigility for this.

Though if you don't have php experience I wouldn't switch languages to get it

https://apigility.org/

That's the beauty of an API. It doesn't really matter what backend language you decide to use. To the front-end client, it's just good old endpoints sprinkled with JSON.
Have there been any implementation decisions that have forced PHP to take a step backwards?

There are many things that they language has had to fix, and some that still need to fix. But I honestly don't feel that the direction in which the language is headed is encumbering the language further.