Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think PHP's main problem on websites like these is that it's too mainstream of a language. It's like asking someone who's an avid fan of world cinema about the latest Michael Bay film.

I'm not that interested in programming, so I think it's a great language. All those years back when first learning to use it, I remember going through a book and being so happy that it did practically everything itself.



> I'm not that interested in programming, so I think it's a great language

I think this sums up everyone I've met who actually likes PHP. They like that they are able to get stuff done, and look no further. It is just frustrating to those of us who know that PHP is one of the most poorly designed (and I use that word loosely) languages ever to be successful.

If you can get over the local maximum of getting stuff done in PHP, the grass actually IS greener in Python and Ruby land.


> I think this sums up everyone I've met who actually likes PHP.

That says more about the people you associate with then with the language.

The people I know care about programming, care about doing it well, care about elegant solutions, and care about a wonderful end product. What they don't care about are stupid language wars.

> the grass actually IS greener in Python and Ruby land.

I never got serious with Ruby, so I'll confess, I might be missing something. But, going by what I see in Destroy All Software's screencasts, I don't feel like I'm missing anything.

I can't help it, but ever since Rails came on the scene, I can't help but feel like the PHP people that make up the PHP community has dramatically improved. This, of course, is purely based on the people I've met.


OK, how about I rephrase to:

> I've never seriously learned a second language, so I think it's a great language

Do the people you know have experience with other comparable* languages, and still think PHP is a well-designed language and platform?

I concede that the PHP community, and PHP itself, has dramatically improved in the last few years. PHP 5 is a revelation compared to PHP 4.

[*] i.e. not "The other language I know is C, and I love that PHP is so high level!"


> Do the people you know have experience with other comparable* languages, and still think PHP is a well-designed language and platform?

For the most part, yeah. There are the obvious quibbles you get with any language, but for it's domain, it's the best bang for the buck. Does that mean it's the only language in our stack? No. But for my money, for the web side, it can't be beat. If I were to do a site in a non PHP language, it would be Python hands down. That being said, it all depends on what the project is, and what it entails.

Listen, I can't help but wonder if your imparting some past on the current crop of PHP developers (and by current, I mean those that moved to PHP5 some 8 years ago). Maybe you had experiences with another group of people that focus on just one language.

The PHP community of today is far from that. It's made up of practical people, who focus on more than just PHP. More to the point, calling someone a PHP developer these days just reflects that when they do the server side web code, they are using PHP. Not that it's their only language.

To be honest, my personal experience is that everyone I've met who pans PHP and proclaims to have switched happily to Rails (because that's what they switch to first, never Ruby), or Python is that they needed the extra structure these languages enforced. Basically, the PHP code they deride so much was code they helped write.

That, of course, is just my point of view. I don't know many people who use Ruby for web development, so it would be unfair for me to suggest the entire community was like that.


> Do the people you know have experience with other comparable languages, and still think PHP is a well-designed language and platform?

Is this the only thing upon which to base your opinion of a language? As someone who's seen at least a glimpse of the world beyond PHP, I'd concede that the design of the language, especially in earlier versions, is probably not its biggest selling point. But as you and I agreed below, PHP derives its value in other areas.

Maybe it's implicit in a question like "What's your most disliked programming language?" that those other areas should be excluded from consideration, but if that's not the case, then focusing solely on language design is a bit unfair to PHP.


> I'd concede that the design of the language, especially in earlier versions, is probably not its biggest selling point.

Keep in mind, the design of the language wasn't to create a new language, but instead, make using various libraries easily usable in a web environment. Hence the reason for the multitude of c or c-like functions. Eventually, the shift moved in a different direction.

I like to think that while PHP wasn't intelligently designed, it did evolve. And for my money, evolution beats out intelligent design.


+Heyo for evolution > intelligent design


> The people I know care about programming, care about doing it well, care about elegant solutions, and care about a wonderful end product. What they don't care about are stupid language wars.

I was just thinking this same thing. My background is mostly in PHP, C#, and more recently JavaScript.

Each of these languages is completely different from each other, but I haven't gotten to point where I curse the fact that one program is written in one language versus the other.

Each language has it features and pitfalls, but as long as you can accomplish the task you've set out on, I'm not sure that it really matters.

For example, I absolutely love the ease of passing functions around in JavaScript, but you can also make a real stinkin' pile if you don't structure things right.

Having used JavaScript, I find myself thinking about using delegates and anonymous functions a lot more in C# than I did before because I've seen the benefit of them in JS.

You can't tell a good programmer by their choice in language but in how they leverage that language to make awesome software.


> What they don't care about are stupid language wars. Then why don't you care about PHP's horrible design, implementation, and development team? I veer away from PHP, fearing very much the Broken Window effect from all the glass scattered in the ground around PHP all the time.


> fearing very much the Broken Window effect from all the glass scattered in the ground around PHP all the time.

You can't program if you use a broken window as a measure of whether you use the language or not. I do not know of a language without issues, ugliness, or mistakes.


I don't know if this counts as meeting, but I consider myself a developer that is interested in programming, doing things right, etc., and I like PHP.

I see PHP as a language comparable to English. Both languages have a bunch of inconsistencies, peculiar idiosyncrasies, a humongous base of speakers/users, etc. In both languages, a lot of what people write is not of high quality, but writing high-quality stuff is certainly possible. If I had to choose one language for the world to speak, it probably wouldn't be English, and if I had to choose one programming language to be used in a given field (say, server-side web development), it probably wouldn't be PHP. But given the reality of the situation, PHP, like English, is an incredibly useful language, and PHP code, like English writing, can be of very high quality. I think this makes it a very valuable language.


I agree that PHP is an incredibly useful language; that code written in PHP can be of very high quality; that PHP is a very valuable language (because every host supports it, and most popular content management systems must be extended using it).

What I don't think it is, is a well-designed one. It could have been all of those other things, AND a well-designed one, it just wasn't. I think it's a shame if a generation of web programmers come of age thinking that the warts of PHP are inherent to all programming languages. (I myself once felt that way about ColdFusion, since it was the first language I learned and everyone I worked with also only knew ColdFusion.)


Rasmus basically said he doesn't care if he copies and pastes stuff around so long as it gives him the end result he wanted. The language reflects that.

And, actually, it's NOT necessarily a bad thing to have a language oriented around people who don't actually care that much about programming when it's also oriented around people who want to ship something useful to an end user (who might care if it's insecure but doesn't care if the code's pretty).

I've encountered a number of orgs now that have PHP on the front speaking XMLRPC or JSONRPC or whatever to a backend daemon (either Java or Perl in the cases I've seen) and since that means messiness on the front end shouldn't be able to violate business rules, it works out really well.


PHP is not much good for security though for beginner developers. It does not help with XSS, CSRF, or SQL injection prevention. If anything it does actually encourage them if you do not know of the risks.


I feel like this is more of a role for a framework built on top of PHP than for a language like PHP itself. PHP itself is pretty low-level. How would you suggest providing better protection against these?

In the past, of course, PHP did have magic_quotes, which was a misguided attempt at mitigating SQL injections. This has since been removed, and there's been a big push in the direction of using prepared statements/parameterized queries through a library like PDO, which I think was introduced in PHP 5.


Agreed, about that this is the role of a framework and this is in many ways what is wrong about PHP. It tries to be both language and a framework with its built in templating. But templating which does not include simple to use support for escaping HTML is a really dangerous tool in the hands of a beginner.

So was the (I believe now deprecated) mysql library they shipped and the tempting ease of string interpolation.


Doesn't the fact that Python won the "Favorite Language" poll kind of show that it's not just about hating on mainstream languages? Python's pretty mainstream, I'd say... definitely top 10.


Python has a very low barrier to entry and that is bad. Very bad, trust me.

That sort of a market generally gets swarmed by low price developers very quickly.


But HN isn't a representative sample, so our poll doesn't accurately reflect the overall popularity of a language.


Your second statements communicates to me that you like it because it's a toy language. It may be useful for just getting something small done and getting started but for someone who looks at programming as an enjoyable craft php loses it's shine. Especially once you've been exposed to other languages that highlight how much better it could be.


I actually disagree to some extent. I know, it's PHP. But it can do some pretty amazing things if you think in terms of files. If you're coming from a C background, it's actually quite nice.

For example, you can use include ( ) in so many ways, autoload classes, write getters/setters and override anything, implement views, etc. Everything "just runs", or can be compiled into fast code with HipHop (or cached with APC).

OK, to be fair, I would say that PHP with a framework that takes advantage of it can be very cool. I can't exactly share our codebase, but you can see the open source version from 2 years ago : http://phponpie.com to aprpeciate some of the "beauty" of PHP

And it can be extremely expressive and powerful. Sure, it can't do everything that Node.js can do, but for serving requests it can be awesome. It isolates every script in its own memory space, so you never have to worry about anything! The one thing I do not like about PHP is that it's married to the outdated thread-based webserver model, while the new boys on the block (NGinX, Node.js and the new Apache) all use event-based programming.

Don't downvote just because I said PHP can be cool. Look at our framework at least, before voting :)


Actually I upvoted you. Just because I dislike PHP doesn't mean someone else can't like it.


I spend a lot of my time writing Python, especially for Django powered sites, and writing client side javascript. Periodically, I'll get stuck maintaining large projects written entirely in PHP and miss the nice features from other languages. Javascript has its bug-a-boos, but with its dynamic design and jQuery, its easy to write clean code. Python is also much cleaner and usually just works.

On the other hand, all of my programming horror stories and terrible hacks have been written in PHP. I remember having to use an older version of PHP that failed to support closures when it was needed in some legacy code. The code was passing functions as arguments, but because the functions were not bound in the local scope, there were issues with namespace collisions. I had to resort to global variables for a situation that should not have needed it because rewriting everything properly required a non-trivial refactoring that I did not have the time to complete. Granted, this has been addressed in more recent versions of PHP, but there are always old versions floating around where "gotcha's" like this show up.

More recently, I ran into an issue porting PHP 5 code across different linux distributions where, for some strange reason, libraries on the include path failed to be found. Debugging something like that is ridiculously frustrating. Problems like this are bound to show up with any technology you use frequently, but my work involves using many languages and technologies and, of them, PHP is the only one that leads to these sorts of problems with such regularity.


What is the definition of "something small"? Millions of users and companies use PHP based software for various business needs, from small to big. Yes, the language has a lot of flaws, but I disagree that you can't create useful and rather "big" software with it. And it's easier compared to other languages. If it solves people problems, why not?


Nothing I said was meant to indicate you couldn't use php for something big. All I meant to indicate was that once you've seen what other languages have to offer and have started to look on programming as a craft php starts to lose it's shine.


Facebook uses a lot of PHP and seems to do fine, just because a language allows you to write horrible code doesn't necessarily mean it can't be used to write good code. PHP obviously has a lot of warts, but I think the bigger problem is that it gives you just enough rope to hang yourself.


There are two kinds of programmers at Facebook: The ones who curse PHP every work day, and the ones who don't use it.

"This language really sucks." -- paraphrased, intro to PHP on Facebook's internal Wiki


I wouldn't be surprised if it happened more than usual with PHP, but in my experience programmers always curse the language/framework/api that they use heavily. You always learn the seams and hit issues with the design if you work with something for long enough.


Yep, It's a phenomenon frequently called "using in anger". The interesting thing about php is you don't have to use it very long before you use it in anger. Most of the time you can tell if someone is well versed in a language if they use it in anger. With PHP all you can tell is they've used it.


Is that was "use in anger" means? I had assumed it came from "fire a shot in anger", meaning serious use rather than practice or ceremony.

It's true that most software makes me either angry or sad, but PHP (where even "==" is wrong after Perl had gotten it right) was a singularly memorable peek into Special Hell.


Nope! I love me some Python, JavaScript, C, and even ActionScrip, Java and Pascal. Blaming the tools is bad form unless you can prove they are bad, which can be done with PHP.


The concept of "bad" is subjective and can't be proven. Don't blame the tools for what the people do with them.


Fair enough. Bad is too broad a term. But I think most developers agree that PHP is inconsistent and lacks type safety. For a long time it lacked namespaces which made for some really silly design patterns. It lacks some neat features too, like lambdas and its support for closures is minimal. The list can go on.


All of the things you listed are missing from at least one of the languages that you listed as your favorites.


Facebook also uses a very restricted subset of php for a lot of it, if the people I've met from over there are any indication. This may make it generally more useful for them than it may normally be.

I think they have to use that subset so it can be compiled by HipHop down to C code.


I agree there is some language snobbery. However, I moved from PHP to Ruby and love it.

My two biggest gripes with PHP:

1) No standard package management system. I worked with some VERY smart developers at a PHP-only company, but nearly every part of their complex system was coded in-house, from the ORM up. Rubyists practically never code things that are available as well-tested gems, saving tons of effort, debugging, and training new people. That's a huge boost to Getting Things Done.

2) Little discoverability. If you can't remember the string method you want, you'll have to Google - and make sure you notice the order of the arguments. In Ruby, you can do `'foo'.methods.sort` and see all the methods available on strings. Since it's OO, you don't have to pass in the string itself, so there are fewer arguments to know in the first place.


I thought PEAR was PHP's standard package manager?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: