Ask HN: Why no love for PHP?

99 points by ironkeith ↗ HN
I'm curious as to why I rarely see PHP articles on Hacker News.

Is it because PHP isn't considered a "serious" language, and is mostly the realm of "designers" and "script kiddies"?

Do the developers who visit this site all code in Ruby, Erlang or Objective-C? Are PHP developers a minority in this community?

I play with Ruby & Objective-C on my own time, but at work it's an all PHP shop. We primarily use the Zend Framework, and honestly it's pretty good (good enough for IBM...). With the recently announced build tools, and some of the classes we've developed on top of ZF, I can develop just as quickly in PHP as I can with RoR.

PHP is also fairly popular with successful startups. Larger sites like Digg, Flickr and Facebook are using at least some PHP to scale to fairly massive traffic; even Wufoo (a site which I feel represents what so many of us here are trying to achieve in essence) is written in PHP.

I will agree that PHP is a bit of a mess (backslashes for namespaces?), and that the internet is full of the wrong way to use it; however, there certainly are talented developers writing quality software in PHP. Is there no interest in that here?

Apologies if this is a rehash of a tired topic; I poked around for a few minutes and didn't see anything relevant/recent.

147 comments

[ 5.3 ms ] story [ 303 ms ] thread
holds hand up I use PHP. Indeed I use PHP for most of my commercial web stuff (i.e. stuff I make at work & most of my startup ideas).

Mostly I'm a Python fan but for websites PHP is just 100% easier for me because I have a framework I know well (KohanaPHP) and years worth of snippets/experience to use in prototying sites. I bet I can code a simple site faster in PHP than Python.

As to why PHP isnt discussed much on here: well I will hazard a lot of people take the same approach. We love exciting stuff in Python, C and Ruby (well, not ao much ruby for me :P) but PHP is our grab-it-and-run language. If someone knocks on the door and says "make me XYZ website in 2 days" we will probably pull out the PHP.

Nothing exciting and new is really happening with PHP - it is doing what it is supposed to do: help us produce dynamic websites fairly quickly with little fuss. So we can get on with the real job of hacking in Python (or Ruby or C or..... etc.) :D

I could be wrong :)

I agree with this statement. I've reached a stage where I could code a PHP-based website much quicker that in other languages. Admittedly it's what I started programming on (and has taught me a few bad things, but certainly kept my interest in programming).

I don't agree that there's nothing interesting going on though. I'd like to see some more innovative extensions (which might be because they are coded in C) but PHP Classes (http://phpclasses.org) is constantly producing PHP libraries and snippets for common tasks

God I hate phpclasses.org

The code is great, but the site is awful, just awful. Mirrors? What is this 1999? How much bandwidth can downloading ZIPPED php scripts use?

Oh yeah, and there's registration required and big, ugly, flashing banner ads.

If someone knows of a site with the same contents, please, please let me know :)

seconded: Im sure there is LOADS of great stuff on there. But I just cant face finding it :)
I can agree with that, the site does look like it's still in the 90s. It's a shame there isn't anything much similar (searching GitHub can turn up some gems though). It's an idea I toyed with once.
How about an Ask HN poll on language preference... anyone?
PHP has a few downsides, everything from poor naming conventions to security vulnerabilities. People around these parts are always looking for the cleanest solutions to their problems and the latest methods available. PHP's relative age and problems make it neither.

That said, I coded my first startup in PHP. It's dead simple to make a dynamic web page with PHP, but it's also dead simple to create a huge mess. In that sense, PHP reminds me of C. It's pretty simple to write an app in C, but there are 1,000 pitfalls.

Just like with C, there are definitely talented coders out there who can make PHP behave correctly. Sadly, they are a minority. Many of them move on to other languages and frameworks.

I've since moved on to Ruby (on Rails) as well as Python. Both languages offer simplicity and power. Rails, in spite of being the Dane Cook of frameworks, makes it extremely easy to create a web application.

Well said. I would recommend Django to people who prefer Python to Ruby.
Django is Rails, without the toxic company.

That's why I am unsure about Zed Shaw at EuroDjangoCon. I love to have smart and capable people around, but Zed still has to prove he can play well with others.

I agree with more or less with what you said but a downside of PHP is not security vulnerabilities, that's really just a myth. I can't remember the last vulnerability which could be directly attributed to PHP as a language.

Sure, there are plenty of apps containing holes but those are not caused by PHP but by not coding correctly, eg not checking input making SQL injections possible etc.

Which might confirm what you said, it's easy to create a huge mess with PHP.

But then, it's easy to create a huge mess in any other language, too. It's probably even easier with Ruby due to its highly dynamic nature.

Languages are like tools, you have to know how to use it but you can't blame the tool if somebody misuses it.

Edit: Fixed typo.

The security issues mostly come from the community; PHP is branded as a language that's easy to learn, and in that same spirit, a lot of the examples offered by the manual and by people trying to teach others are horribly insecure.

I think nearly every SQL example, for instance, totally ignores the concept of SQL injection.

Languages are like tools: buying a the best set you can afford is the best possible start to a project. PHP doesn't cause SQL injection flaws, but it doesn't make it any easier. How many escape functions are there ? Shall we count them ?

----------

mysql_escape_string() - Escapes a string for use in a mysql_query

mysql_real_escape_string() - Escapes special characters in a string for use in a SQL statement

mysqli_real_escape_string() - Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection

addslashes() - Quote string with slashes

stripslashes() - Un-quotes a quoted string

The magic_quotes_gpc directive

The magic_quotes_runtime directive

stripcslashes() - Un-quote string quoted with addcslashes

stripslashes() - Un-quotes a quoted string

addcslashes() - Quote string with slashes in a C style

htmlspecialchars() - Convert special characters to HTML entities

quotemeta() - Quote meta characters

get_magic_quotes_gpc() - Gets the current configuration setting of magic quotes gpc

----------------

I especially love the contrast between "mysql_escape_string" and "mysql_real_escape_string," since the first one is fake in a magical, side-effect-laden way.

I think this comment sums it up nicely: http://blog.ianbicking.org/php-ghetto-comment-11.html

It basically argues that in PHP there's often an easy, insecure way to do something and a verbose, secure way to do it. With regards to SQL injection, Java is the same way; prepared statements are much more verbose and annoying than string concatenation.

I regard string concatenation as very annoying in Java.

Actually, just about anything is annoying in Java. I guess I have been spoiled by more modern languages like... Smalltalk/80 or Lisp'56.

They do exist, but I would never use any of them. I'd use a prepared statement. PHP has come a long way since stripslashes. It just isn't flavor of the month.
http://osvdb.org/search?request=PHP

http://osvdb.org/search?request=Python

http://osvdb.org/search?request=Perl

http://osvdb.org/search?request=Ruby

"One of these things, is not like the others, one of these things is not the same..."

No, there's nothing "mythical" about bad PHP security. At the point where there is a two order-of-magnitude difference between PHP and Python/Perl/Ruby, I stop even really caring about the "why". PHP may be popular, but it's not that much more popular. (And even if you want to say that PHP is two orders of magnitude more popular, well, not all Python/Perl/Ruby vulns are web-related, either.)

Ok.. nice way to leave logic at the door, but it's not just that PHP is more popular. It's that it's been around longer than Python and Ruby. That list goes back a decade for PHP.

Anybody using PHP seriously in a production environment is also using Suhosin and PHP is secure enough at that point to just be a consideration and not a problem.

No, as documented by others, it is that PHP has a long history of virtually begging you to put security vulnerabilities into your app, then jerking you around with crappy fixes, which interact poorly with other crappy fixes. As far as I am concerned, I can't afford to use PHP, because the community has a long, long, long history of claiming X is secure when in fact it is very, very not. ("No, really, we got it this time!") I have no reason to trust your assurances that no, no, really, really, it's all right this time, if you add this thing that I presume is not a core app and tweak it right and... no, thanks. The PHP community has no credibility left on that front, hasn't had it for years, and I've not seen some burst of skill lately that convinces me any differently.
PHP's four years younger than Python and a year or two younger than Ruby. Age is no excuse for its security problems -- nor is the No True Scotsman fallacy sufficient to wave away its flaws.
Well, all those bugs seem to be related to apps written in PHP but not related to PHP itself - other than at some places making it confusing for beginners to know what to use. And if there are many bugs in apps this is also correlated to the fact that there are a LOT of apps but not enough good developers... ;)

I like this quote about PHP: "HP is just this piece of shit that you just put together—put all the parts together—and you throw it against the wall and it fucking sticks." (Terry Chay)

Amusing. Rails as the "Dane Cook" of web frameworks pretty much hits the nail on the head.

I love Rails but the fanboy culture really sucks.

That reads to me as "Rails is a pop culture icon that only XYZ people know about." I'm not XYZ because I don't know who that is.

Actually, perhaps unintentionally, you still hit the nail on the head.

Glad to be your unintentional hammer.

Dane Cook is a comedian who hit it BIG, in part, due to MySpace. He's been in a couple of movies, including "Employee of the Month."

He's got millions of fans, but also a sizeable group of haters, inlcuding many of his fellow comedians. He's just another in a series of people or items that hit it big, leaving many of us wondering why.

Could it be that he's hated because he steals material?
Well, I didn't want to get into the details here, but yes, that's part of it. :-) He's also been criticized for not actually telling jokes when it is his material, being/attracting the worst sort of humanity, etc.
A worse insult would be calling it the 'Carlos Mencia of frameworks'.
Just think of him as a comedy aggregator, something like a real life Digg/Reddit/etc. :)
Just like with C, there are definitely talented coders out there who can make PHP behave correctly. Sadly, they are a minority. Many of them move on to other languages and frameworks.

What does that mean? I'll take the compliment, but I'm not sure what the difficulty is in making PHP 'behave correctly.'

I think PHP compares well to the saying "Guns don't kill people, people kill people." Most of the time security issues are in the hands of the programers. Although, PHP sure makes it easy sometimes to create those issues.
It reminds me of Perl. Perl literally gave me a headache last time I coded in it. (Incidentally, this is why I'm wary of Ruby as well.) Besides, I am totally satisfied with Python.
I don't see too much similarity between Perl and PHP. Perl has a the syntax of a loose cannon. PHP's syntax is very Java like.

* PHP doesn't have special variables that change things about the language like, the starting index of an array.

* Out of the box, Perl requires you to import modules to get functionality that PHP has with a simple function call.

* Perl has support for classes, but you feel like it's a hack every time you write one.

* PHP has classes, that give you the notion that they are part of the language (which they are of course, so are Perl's)

Until recently, I hadn't programmed in Perl in years, but I find that coming back to it again has given me a new outlook on it. You might wanna take another look. I still much prefer Python though.

Perl is also way faster than PHP, and has had nice things like closures since... well, for a long time now. Not that I'd want to use Perl these days, but language-wise, it's a bit more advanced than PHP is.
way faster -- sounds subjective to me. What references say this?
>>* Perl has support for classes, but you feel like it's a hack every time you write one.

Check out Moose for Perl. Then name an OO system in production that is better.

(-: If you can give an example, I'll immediately buy a book on it. :-)

Edit: Syntax.

I've seen Moose, but haven't actually used it. The codebase I work with at work uses the ole Perl blessed hashes, and we won't be switching any time soon.
PHP is like a mobile phone that's a year old - it's perfectly good, but ain't what the cool kids are playing with.
Except every year the 'cool' phones come and go, and PHP is still around, kick ass and taking names.
And my Nokia 5120 still boots up like it's first day when I pull it out of the discarded gadget drawer.
Do you mean because it's never been used?
PHP offers little more than convenience. I use it myself because it's so easy to integrate with PHP and MySQL, and it's easy. I think it's a decent platform for a basic web-site, but further than that it doesn't offer anything truly unique or powerful.
I'd love to see more PHP on HN (I am here to learn, primarily, and PHP is what I do), but the problem seems to lie in there being a lack of quality PHP articles. Maybe I'm being unfair, but just lately I've been getting the impression that the more someone knows, the less likely they are to share.
I follow the Zend Developer Zone (http://devzone.zend.com/public/view) and find that an interesting article pops up every now and then. I've added a few developer blogs to my feed reader from articles that I discovered there.
You can't downvote articles (only flag them)?
You can downmod after you've reached a certain karma threshold.
I was pretty sure this only applied to comments, not articles?
WHat would you recommend for getting into Ruby? I tried it once but their site is horrible and the "Hello World" example is really babyish and idiotic - and it put me off :)

I've never "got" RoR. Python makes sense to me as a killer all-purpose language just as PHP makes sense to me as a niche for-the-web language (I cant get these people that insist on running PHP standalone :o). But I never quite figured the rails niche.

ErrantX

I would highly recommend learning Ruby before trying RoR. The first time I tried to learn RoR I didn't know any Ruby. I had limited success because I had to battle the framework and the language.

You don't need to know everything about Ruby to start on RoR, but you should be able to write some basic programs.

There are a number of online resources for Ruby:

Unofficial and old, but has a lot of good info: http://www.math.umd.edu/~dcarrera/ruby/0.3/

http://www.whytheluckystiff.net/ruby/pickaxe/

http://www.ruby-doc.org/docs/UsersGuide/rg/

http://qa.poignantguide.net/index.html

For RoR guides online, I didn't find anything that I really liked. I ended up with Sitepoint's Simply Rails 2.0 and followed it. I didn't find any free guides/books that really helped me much. Once you get a basic understanding of MVC you can learn a lot of from http://railscasts.com though.

PS: Sorry to everyone for the RoR/Ruby hijack

EDIT: Wrote a sentence misleadingly, fixed it.

One of the things that I think is relevant to startups hiring is that (warning experience mixed with opinion ahead) there are lots and lots of PHP developers of wildly varying quality. This makes the initial stages of recruitment time consuming. By looking for people with skills or interest in Ruby, Python or Scala (or whatever is hot that month) you'll probably see less interest but, on average, the quality and enthusiasm will probably be greater. Which means it takes less time to hire (well, maybe), as well as getting the better people (hopefully).
PG made similar arguments in his 2004 essay "The Python Paradox" - http://www.paulgraham.com/pypar.html

I'm inclined to agree. If you know how to advertise within a language community then using a lesser-known language will make it easier to find good programmers. This is probably even true for the short-term contract gigs often posted to freelance sites since there won't be hundreds of low-quality responses to sort through.

I've been using PHP at work and on personal projects for years. It has a very low "barrier for entry", which is both good and bad. It's easy/cheap to hire entry level programmers to write simple PHP, but it's all too easy to let them jump into big projects too soon and write something that turns into a huge mess. Well written PHP code can be just as easy to read as Python/Ruby/etc., but PHP makes it far too easy to write something that is a horrible mess.

At work we are still mostly a PHP shop, but anything I write on my own now gets done in Python. PHP's complete lack of a coherent function naming scheme is enough reason alone to get away from it.

PHP doesn't get mentioned, because it isn't interesting. I've done a lot of PHP work, and still do. But there's not a lot of NEW going on in the PHP world. Their latest earth shattering move is namespaces. The only interesting thing about PHP's namespace support is how awful it is.

Almost all of the cool concurrency, natural language, efficiency, functional programming, and what-have-you research and development, is going on outside of the PHP community. Those are topics that HN collectively finds interesting, so PHP gets left out.

That said, just because PHP itself isn't particularly interesting, doesn't mean people don't build interesting things using it, and doesn't mean you shouldn't use it.

there's not a lot of NEW going on in the PHP world

There was an article on slashdot yesterday about PHP6. Here's one from IBM:

http://www.ibm.com/developerworks/opensource/library/os-php-...

Not a whole lot of new, but something. I think PHP gets ignored sometimes because it is an older language, not the new and trendy thing.

> * I think PHP gets ignored sometimes because it is an older language...*

For what it's worth, Python is four years older than PHP, and it still gets a good amount of attention on HN. Python just has more of the "inspiring language" atmosphere, while PHP has more of the "corporate, mundane" feel. And I'm an avid open source developer working on multiple PHP and Python projects...

All righty; I'll give you that. Try this logic: maybe because Yahoo! is all about PHP and Google is all about Python and Yahoo! is older than Google. :)
People who are really good at their jobs obsess about their tools- artists obsess over their paint, carpenters obsess over their power tools, cooks obsess over their knives.

PHP is like buying a chef's knife at Wal-Mart. You can create a 5 star dish with it, it cuts perfectly fine, but it doesn't inspire the same passion that a Shun knife does.

Most restaurants in fact, don't use fancy-knives, they use just regular knives and it works out just fine.

But, to draw the analogy back to programming, we're not regular restaurants. We're wannabe "rock-star" chefs- coding and "startup-ing" isn't just a job, it's part of our core ethos, so we obsess over all the tools we use, the text editor, the monitor, even the chair- because it makes the experience all that much better.

Most people do this about things they seriously care about. Runners debate intricacies of running shoes or the perfect in race meal. I've had debates with weight-lifters about weight-lifting gloves. Go over to a different forum, and you will hear arguments about the perfect size of a suit lapel.

The "Everyman" tools can always accomplish 100% of the job, but provide 90% of the experience. We spend an inordinate amount of time trying to get that last 10% out.

Is it probably unnecessary? Yeah. But people really bond over passions, and in arguing/debating that last 10%, you can really connect with people, which is why sites like Hacker News are fun and addictive.

That's fine if you're starting a project or a business from scratch. Choose whatever tools make you happy. But if you work for someone else, chances are you will be stuck using the language they use. And if you are professional, you do it. And you still try to do a good job. Like Tiger Woods switching to Nike clubs.
professional and passionate are not necessarily (and, for most people, not usually) the same things. you can use a php framework professionally and be passionate about rails.
I think your analogy is great. While I agree that "most" tools will accomplish the same goal or job (Walmart knife vs Shun). I don't agree that the tool determines passion or commitment. I'm a PHP developer (just started learning python!). I work full time for a big website that is coded in PHP. I have a startup that is written in PHP. If you had a conversation about PHP with me, I'm super passionate about what I have accomplished and will accomplish in the future. I think the real problem is that the passion pool gets diluted... Let me explain...

PHP has an extremely low barrier to entry. Its a loose language (lets not argue about this right now) that someone can get their feet wet relatively quick. These developers never really learn the true power of PHP, they aren't passionate about their projects and they dont contribute back to the community. They dilute the pool of truly passionate PHP developers.

Owning a Shun knife just lets everyone around you know that you are "serious" cook. But hell, I like to cook too.

I agree with you wholeheartedly. Passionate people love to communicate with other passionate people, PHP as, you said, has a lower barrier to entry- it's like the Java of web languages. There's too many people and companies that just churn out php and java code as a job. It's not an ethos to them.

Just because you use PHP doesn't make you passionless, but because it's gone "mainstream", it becomes a filter of some sorts- just like the Shun is getting too popular right now.

It's not about the specific tool you use- instead it's about the passion and ideas that the tool conveys. In the end, the tools are meaningless. It's the ideas and messages around the end product that people remember.

It's not just the experience. Languages like Ruby and Lisp tend to be a lot more concise and have more functionality than PHP, so it's more like comparing a blunt knife to a razor sharp one. You can still cut with a blunt knife, but it takes longer and is harder work.
I would argue that PHP and the LAMP stack have more functionality than any other language by an order of magnitude when you're talking about web development tasks. For anything else, PHP is pretty much irrelevant, but when you're doing web development, it's definitely the swiss army knife.

Without a single import or require, you can send emails, query a database, download a web page, handle session data, get post variables, etc.

You've also got file access, date and time functions, regular expressions, the list goes on.

What more functionality could you need for a web app?

It's interesting that you think in terms of web app. I generally think in terms of data model, and then web app is a structure on top of that. Much of my background is in delivering complex web applications with no javascript or other fancy stuff.

Previous customers have wanted lots of functionality in as few (and fast) page reloads as possible, with lots of reporting on each page. This results in a small number of mega pages backing onto a 'Service Layer' which in turn sits on top of a schema. Multiple applications can be hooked into the domain model to preserve data integrity.

I'm not as strong as many geeks I know at keeping complex things in my head. My experience of PHP (I've shipped apps from 3.0 to 5.0, but I've never invested enough time to know it well) is that it has weak language structures and weak object relational modelling capabilities - this makes it difficult to manage the sorts of complexity that I've encountered.

    For anything else, PHP is pretty much irrelevant, but
    when you're doing web development, it's definitely the
    swiss army knife.
By way of comparison - in python there's a http interpreter in the standard library that you can bind to a webserver in seconds, and you can write a simple templating library in a couple of minutes too. It's got XML-RPC in the stdlib too that makes it ridiculously easy to offer services to other applications. Perl has similar stuff via cpan, ruby via rails.

    What more functionality could you need for a web app?
I've found powerful object modelling to be critical. The Java platform has always been strong in this.

One thing that is nice about PHP is that you instantly get to the point that you change something and then reload - bang you can see your changes. CGI approaches aside, that's not such an easy point to get to with the other languages I know.

I tend to think in terms of language design, so by "functionality", I meant it in terms of syntax, rather than external libraries. Sorry, I should have been more clear.
You're kidding right? You're claiming that Lisp has more 'functionality' than PHP. By functionality, do you mean standard library? Or do you mean core language?

Elegance != more functionality.

Usually people talk about Lisp's superior expressiveness. The ability to "draw down" (or up) a language to the concepts you're working with directly is a powerful thing, and very few languages do that as well as lisp.

Maybe that's what he meant? "Functionality" of a language is kind of a vague term.

My apologies, "functionality" isn't a very precise word in this case. I meant it in terms of what functionality is in the language's syntax. For instance, Lisp has macros whilst PHP does not. And whilst later versions of PHP do support things like first class functions, they do so in an unwieldy and verbose fashion that negates a lot of their advantages:

    #(* n %)

    (* n _)

    (* n)

    function($x) use ($n) { return $n * $x; }
One of these things is not like the others :)
Great argument, nice analogy, makes a lot of sense, and I completely (and respectfully) disagree.

Your analogy reminds me of the greatest cook ever, my grandmother. She used no technology whatsoever. All of her tools had been her mother's which were probably manufactured in the 1800s. She chopped everything by hand in a wooden bowl. (If anyone else helped her with the chopping, everyone at dinner could tell.) She never used pencil or paper and measured nothing. She stood in line at the farmer's market, the butcher, or the grocery store and inspected every item. And absolutely nothing I have ever eaten since, in any restaurant or home, has been remotely close to hers. It was magnificent! And I miss it so much.

I'd like to think I have almost as much passion about my work. I use the most primitive tools, 24 x 80 green screen editor, no framework, no IDE, no debugger, and mostly pencil and paper. I savor every byte just as I imagine my grandmother savored every little detail of her cooking. I'm not trying to save time or be fast, I just aspire to creating Grandma-quality software. I only hope my software brings someone the same joy her food brought all of us.

I've used many different tools, including php. And I rarely care how fancy they are. Ironically, the simpler, the more joy I have found along the way.

Your grandmother used the tools that she was taught the trade with. She used simple tools that she'd spent years learning to use properly. She spent years learning how to read the products that her craft relied on. She was passionate about what she did, and it showed. Stories like that just reinforce the idea that it almost doesn't matter what the tool is as long as you take the time to truly master its use.
I don't think your story is incompatible with my analogy, in fact I think it's totally in-line with my analogy.

Many hobbyists who have reached the utmost peak level in their art go totally primitive. Cooks grow their own food. Carpenters make hand-made furniture, people really serious about clothes go bespoke.

Just because we spend more time agonizing over things doesn't mean we have to spend more money on them. More "expensive" and "fancy" doesn't make them better- in cooking, look at the revival of cast-iron cookware and the people learning how to sharpening their own knives. The coffee snobs don't buy the most expensive starbucks brands- instead they go order fresh coffee beans, roast themselves, and then grind them. A person really into clothes doesn't get the latest Tom Ford/Armani suit- they instead get a bespoke suit from an English tailor, which is often far cheaper. There has been a movement away from $150 running to shoes to shoes like the vibram five-fingers to even barefoot!

Why do masters of the art do that? I think it's because of the idea that you can create something from nothing. This is very easy to do with computers (programming is the only profession where you can truly create something from nothing, limited only by your mind). You're not limited to someone else's vision when you do this- you can have everything exactly the way you want, the way you care about, the way that lets you exude your passion the most.

The guy who uses Ruby on Rails is no different from you, you just create your art in different ways. Using a green screen editor doesn't matter to them- they're not stirred up by it.

Instead, they get stirred up by using RoR. Maybe RoR solves a unique problem that they've been dealing with. Similarly, the guy tired of dealing with Java switches to Clojure and experiences the same light that you're experiencing- going simpler doesn't matter that too much to him.

There's no right or wrong answer in simplicity vs. complexity. Someone out there (Wozniak) is more of a purist than you and is writing everything in Assembly. The guy writing the latest and greatest web application is using Django because it's the simplest, most purest way to solve their problem- and when they get passionate enough about it that this is no longer the case, they'll go write their own.

You can get caught up in the tools and the techniques, but the one thing that really matters is that the examples I gave (and the example that you gave, which I love and will definitely remember) are of people expressing their passion. We may express it in different ways, but at least we're exuding it.

People that don't exude any passion drive me crazy.

Agreed. You have a nice way of putting these things.

I said "I disagree" when I meant "This just doesn't apply to me". Sorry.

So cooks, carpenters , people really serious about clothes are "hobbyists who have reached the utmost peak level in their art" but when I buy green and toast then grind for myself, I'm just a "coffee snob"... hmm... no Monsooned Malabar [1] for you.

[1] http://en.wikipedia.org/wiki/Monsooned_Malabar

I savor every byte

Nice line ;-) "Ahhh yeah that's a good 11001010."

But why 24 x 80, not bigger?
(comment deleted)
>>> artists obsess over their paint

Actually a lot of top artists don't. Not only because paint isn't their medium but because they don't do the work themselves. They have the ideas and then they employ minions to do the actually work of making the piece. Personally I think that makes them less than an artist, but they're the ones selling work for 100s of thousands of £s

F'real.

that's interesting to know! That also sounds like a big scam to me! I definitely want to read more about that process, if you have anything stored in your bookmarks!

I was thinking of artist in the traditional sense- some renaissance painter mixing pigments and material to come up with the perfect shade of red, for example.

I was thinking of artist in the traditional sense- some renaissance painter mixing pigments and material to come up with the perfect shade of red, for example.

This is just a romantic myth. All the Renaissance painters anyone has heard of or seen in a museum employed tons of assistants.

Nearly any contemporary artist who makes any sort of money whatsoever has assistants doing most of their work. Damien Hirst has 160 employees! Murakami has dozens of employees. It even trickles down to smaller time guys like Ryan McGinnis.

They probably had to do all that stuff themselves before they were famous though.
Before they were famous, they were the assistants.
">People who are really good at their jobs obsess about their tools- artists obsess over their paint, carpenters obsess over their power tools, cooks obsess over their knives.

Most people do this about things they seriously care about. Runners debate intricacies of running shoes or the perfect in race meal."

And yet one of the most grueling races in the sport of running, the 100 mile, 10000ft altitude Leadville 100 has been won more than once by a man not wearing true shoes at all.

This isn't an isolated example, either. Many masters of many fields focus on their skills rather than their equipment. Often those with the most expensive golf clubs, are those trying to compensate for a lack of skill. The same is true of photographers an their cameras. Miyamoto Musashi even went so far as to regularly arrive at duels with a wooden sword.

Tools can give someone an edge, but IMHO they aren't the right place to focus one's obsession.

Splendidly put.

I'm a chef, and I don't want to talk about knives. I don't care that my knives are basic; taste my cooking. I don't care that your knives are wonderful; I want to taste your cooking.

There's a reason that taste tests are done blindfolded, you know - ugly but delicious trumps beautiful but foul, every day of the week and twice on Sunday.

but presentation is a big part of cooking. good chefs can't just throw their delicious food on a plate they have to make it look good too.
Then perhaps you'd like to volunteer for a little experiment I've devised to find out how important it is?

It basically involves a chocolate mousse that looks like a bowl of faeces, and a bowl of faeces that looks like a chocolate mousse...

(comment deleted)
No? I guess I'll take that as concession :)
Back in the day, PHP was exciting. It was free, it was powerful, it was easy to learn. Everyone coming out of college knew C anyway and it has a similar structure. You could suddenly give your circa 1999 web pages a page date in REAL TIME and you could respond to forms without nasty cgi-bin. Eureka!

Nobody gets excited about it anymore because it solved the problem it was aiming to solve a long, long time ago.

When you know you could save pages of code with it, being without proper higher-order functions is beyond tedious.
I use PHP every day at work. I find that the best way to program PHP is to pretend it is java and ignore (almost) all the other features. Many of the features of the language are very powerful and because they are so powerful, PHP has a tendency not to scale well.

If there are 200+ ways to do one thing you can guarantee that looking at someone else's code will always be an adventure. You CAN write good code in PHP, but it is flexible enough that bad programmers will be able to take it and do much worse things than they could with, say, java.

Call me old hat but I think type safety is an important aspect of scalable projects. If I could add one feature to PHP it would be enforced type safety.

If these articles are thought provoking, they could be written about PASCAL and reasonable HN members would upvote it. Someone can be a language snob, but also a computer scientist; computer scientists keep an open mind.
There are lots of reasons.

* PHP attracts idiots. Partly that's because you don't need to know anything to make simple PHP. So, in the large pool of PHP programmers, there are a ton of idiots. And those idiots produce a lot of verbose code that gets used because it does something. Ruby, Python, Perl, etc. all put up a larger barrier because they don't just come with a session handler or whatnot built in. And that weeds out more of the idiots. Doesn't really have to do with PHP the language, but it is nonetheless significant.

* PHP has a bad type system that leads to errors. There, I said it. The fact that 0 == "string1" and 0 == "string2", but "string1" != "string2" is unacceptably bad.

* PHP has no namespaces. Yeah, they're planned for 5.3, but the implementation is just ugly. This makes it more likely to botch something in a larger project.

* Which leads me to my next point: include/require. In PHP, it's decently common to say require('some_file.php'); and just grab a huge hunk of code. Eww! That code could be doing anything - adding in variables, executing code, etc. While it's true that other languages can do that as well, that's generally not the case - other languages are more in favor of importing objects or functions. Partly it's a language thing, partly it's a culture thing.

* Magic! So, how does mysql_query() know which database to connect to when you don't pass in a database connection? I mean, I'm guessing they're either using a global or if it's in C a static external variable, but PHP is littered with this crap. It's not necessarily bad, but it's magical.

* Functions! So, PHP now has cool object oriented stuff. Still, it doesn't use it at all. I don't object to strlen($var) that much when compared to $var->len(), but there are other cases where it's just crappy. So, PHP has a function strpos() which will return the position of the first occurrence of a substring within a string. Quick! In what order do you put the variables? In this case, it's string to be searched, search string. What about preg_match()? Oh, there you put it in the reverse order! And really, when writing functions, there is no "proper" order, but if you're doing $string.preg_match('/^apple$/'), there's a clear order.

* Looking more at preg_match(). What does it return? It doesn't return a match, it returns a count of the matches it finds. If you want the matches, you need to pass in a variable that it will take a pointer to as an argument so that it can place the matches in there. Bleh! How would this be done in a nice OO-way? $var->preg_match('/^apple$/').count() would get you the count and otherwise you get the match returned. Easy in a way that requires less memorization of weirdness and doesn't feel so wrong. And crappy things like that are done throughout PHP where things are weird, but end up

* php.ini. Terrible idea. PHP allows you to change very important things install-wide, directory-wide, app-wide, ick-wide! It's not just magic quotes. It's more that you never quite know what you're deploying to in a bad way.

Finally, it's that PHP is an older-style language without the cool things that newer languages can do. PHP isn't bad per-se, but it isn't good either. The biggest thing it has going for it is that it's easy on shared hosting. With VPSs coming down in price to the point that they don't represent a huge premium over shared hosting, that's become less of an attraction. PHP is fine, but there's a decent amount to get annoyed with when creating a larger application.

I think the first reason is probably the most significant. A lot of the other things are just warts and pet peeves, but what really got me down working with PHP professionally was the level of code I had to work with. Not only did I end up having to maintain flaming wreckages of code written by people who couldn't even properly be called amateurs, but after doing it for a couple years I found it very hard to improve my craft by seeking out good code to learn from.

I jumped headlong into Rails 4 years ago after having been enamored with Ruby over Perl for sysadmin type scripting and text-munging. Yeah Ruby has some bad warts too (the runtime!), but the quality of code in the community is an order of magnitude better.

Yep - the first is the most significant because of the others.

Which is to say, most people with a clue or with much experience see all the problems with PHP and move onto something else and have no problem doing so. The remainder are those who either can't or won't and a large percentage of them are the "idiots".

This is embarrassing, but I had no idea that 0 == "string1" would return true. I had to write a test script to verify it.
Well said. The thing that bothered me the most when I forced myself to use it was that it seemed like a high-school language hack tried to rewrite perl and got some of his buddies to help. Each of these guys hacked in their own versions of standard functions ad-hoc, and they each chose their own naming convention (e.g., strcmp vs str_replace). There is no uniformity in the language. Elegance is completely lacking.

If you're new to programming, don't waste your precious memory to inventorying an ugly mass of built-in PHP functions. Just pick Python, Ruby, C# or something else--anything else. If you have to learn it for your job, well, learn one of the other languages anyway.

Because that's exactly what it is! I remember PHP when it was PHP/FI, "personal home page form interpreter".
I can't say I love PHP, but some of your criticisms are a little silly.

For example, about typing... your argument is that when you cast a string to an int, it returns 0. What would you have it return, null?

Typing is jank in a number of ways, but in most cases I See the logic in the original decision. To a noice, the idea that false == "false" (because "false" casts to 0) but true != "true" just seems broken. But what else would you have it do?

About namespaces, people are complaining that PHP should use the dot operator like every other language. PHP uses dot for concat, which eliminates the ambiguity of using + for both concat and addition that exists in other languages. Now, they're going to use a backslash for namespace resolution. And that does create operator ambiguity. So PHP trades one ambiguity (dot) for this other.

And what do you possibly mean by "older style language"? Do you mean functional features? As you probably know, lambad's and closures will be available in 5.3. I agree that Python (my language of choice) and even C# (my 2nd fave) seem cleaner. But of course they do. They're new. Java seemed clean in 1997, too.

And finally.. I do value consistency in userland code and in the runtime. And PHP is horribly inconsistent. A salvation army of a language. But that stopped actually affecting me about 8 years ago when I left behind VIM for a real IDE with intellisense.

But what else would you have it do?

Well, to be fair, most programming languages don't have this problem so it isn't actually that hard to overcome. The problem is that PHP attempts to automatically re-cast variables to different type. So, you try to do int(0) == str("apple") and it says "hmm, we have different types here, but if I made them the same type, maybe they'd be equal. Well, strings should just be integer 0 and int(0) == int(0) so that makes true, right?"

Most languages won't automatically re-cast variables. In PHP, "0" == 0 and "1" == 1. In most languages, they are not equal because they are different types. PHP's auto re-cast gets you into a lot of trouble. What would I have it do? Not auto-recast things to different types. I wouldn't call it a silly criticism seeing as though Java, Python, Ruby, C# and I'm sure others lean my direction rather than PHP's direction.

I agree that Python (my language of choice) and even C# (my 2nd fave) seem cleaner. But of course they do. They're new.

Um, Python came on the scene in 1991. PHP's from 1995.

The reason I'd call PHP an "old style language" is that, while it may have new features, many of those new features are poorly implemented in a way that shows a lack of understanding of the value of those features and that none of PHP's library uses those features.

Strings are still primitive data types in PHP. Since strings are primitive data types and not objects in PHP, you can't have the little nice things that you get in ruby, python, java, c# without resorting to functions that take the string as a parameter. $string->match('/pattern/') is much nicer than match($string, '/pattern/') simply because you don't need to memorize the order the arguments are passed in. And, as I pointed out, PHP isn't even consistent about it. Sure, you can say that PHP has OO-capabilities, but it doesn't use them in the library which means that all the library stuff you'd do doesn't leverage any of that. PHP also doesn't support multiple-inheritance or mixins which makes OO a lot less useful.

PHP has added new stuff, but it's just not all that useful because everything is old stuff and most PHP programmers wouldn't know the difference between a reference and a copy even to have an opinion on it. Other languages are a lot nicer to use not just because of features, but because you actually get to use those features with the language's and library's built-ins.

It's not that PHP is terrible or anything. It's that it was originally meant for things that didn't require complexity. When people wanted to use it for more complex things, it seems like they said "object orientation, that does complexity" and didn't really know what the term meant or why it was useful when they implemented it. Part of it might be not wanting to break backward compatibility and so one can argue that those who originally created the language made a crappy tool and now the current people have to keep that all alive while other languages were designed better from the start.

And the real question is, what does PHP offer to overcome this crap? And it really doesn't offer (at least me) anything. I'm not going to be using a shared host and so PHP's run-anywhere-ness doesn't help me. Other than that, I can't see a reason to run PHP over a nicer language. It's not that PHP is so terrible. To be a bit of a troll here, PHP's like Windows 95. Awesome when it came out, but now it just looks old. When PHP4 was the in-thing, it was easy to cook up a hack-ish script and get it running on any shared host. Now, other languages have great libraries, much better deployment options, and just a nicer coding experience. I remember the time before other languages took the web seriously. PHP rocked then. It offered everything you needed to make a little web app with built-in functions. And other languages wanted me to jump through all sorts of hoops to do simple things like sessions. PHP was like a language and framework in one. The problem is that people coding in other langu...

What would you have it return, null?

I wouldn't have it return anything. I'd have it throw an exception (type error). Dynamic typing can be a Good Thing. Pretending types don't exist is probably a mistake.

PHP uses the backslash for escaping characters in strings and for line continuation. There's ambiguity being created any way you look at it.

Many languages much older than PHP seem much more modern. Scheme, Smalltalk, Haskell, Python and even Perl come to mind.

(comment deleted)
>>> PHP attracts idiots. Partly that's because you don't need to know anything to make simple PHP.

Bit harsh. People are not idiots because they haven't studied computer science and don't know their algos from their elbows.

PHP is easy for quick and dirty - primarily business doesn't care how dirty the code is provided it's done quickly and the crashes don't hurt the bottom line too much.

A good list, but I just have to add one which is a killer for any good app:

PHP has terrible unicode support. Almost uniformly every app that starts out using the default PHP function set ends up failing horribly when data with non-european (or even just non-ascii) characters end up in it. There are a whole lot of kludge workarounds, but they're basically an admission of defeat rather than a real statement of support.

PHP is not a language that was designed to be a language. It was originally a set of scripts that slowly morphed into a kind-of language. Because of that, PHP lacks a lot of the language features (threads, namespaces, proper OO design from the ground up) that "serious" languages all have. Ruby was buit to be the best language Matz could think of. Erlang was built to be a great language for programming telecoms. None of the "serious" languages morphed out of some CGI scripts.

As I already mentioned, PHP is not an OO language. It is a language that has OO as a feature, but the core API is not OO. This creates a very awkward mix of OO and procedural code.

One of the most embarrassing things about PHP comes from its complete lack of naming and ordering conventions. Look at the array functions. http://us.php.net/manual/en/ref.array.php 47 of these functions start with array_, 25 of them are a mismatch of whole words and partial words that happen to do array functions. The reason PHP documentation is so good is out of necessity. Without fantastic documentation, PHP would be completely unusable due to this staggering oversight.

I abandoned PHP about two years back. 8 months ago, after going to a conference and hearing the folks at Flickr talk, specifically Cal Henderson (http://www.krisjordan.com/2008/09/16/cal-henderson-scalable-...) I got re-energized to take another stab at making PHP pleasant to work with.

The results of my last push evolved into a PHP framework: Recess. (http://www.recessframework.org) It's got annotations for a declarative, meta-programming style. It's inherently RESTful (and more fine-grained content negotiation is coming soon). The Models/ORM are lazy so that you can chain together queries that evaluate at the last minute. Recess deploys just fine to commodity $5/mo servers and was designed to be lightweight and fast without giving up object-oriented design (a la Code Igniter).

What I feel gets lost in the "PHP is terrible" literature is a distinction between PHP as a programming language and PHP as a technology / platform. As a programming language, from an academic perspective, PHP is embarrassing. As a technology/platform it's incredibly well suited for web applications because that's exactly its intention. PHP's shared-nothing execution model, simple deployment, efficiency & performance make it a great technology for authoring web applications. Tooling has gotten much better too with Eclipse's PDT & XDebug.

If you're growing tired of PHP and looking for a platform/framework to develop on that is more productive and enjoyable try taking Recess for a spin. For me, at least, it's made PHP fun again: http://www.recessframework.org/

Every language must balance expressivity, performance and utility.

I think PHP strikes a good balance, and Recess definitely has the best performance I've seen out of any ActiveRecord ORM in PHP.

I'm a big fan of PHP for myself. But I've seen enough of PHP script kiddies out there making nearly free (as in beer) websites/webapps. They become a mess in no time.

Mostly hacking phpnuke, joomla or some other messy portals. Hacked sites mostly never get any security updates or any kind. But employers having free work done are ok with this scheme so more and more script kiddies emerge.

Also there is not much thing going on PHP nowadays. Maybe PHP is at peek for it's purpose - doing web apps easy and quickly.

I've got nothing against PHP, it's just a matter of preference. There are a lot of fantastic apps built using PHP and I use them on a frequent basis. However, if I build something, it's Ruby all the way. I just find it much cleaner and pleasurable to develop with. Looking at PHP makes my eyes hurt now.

The great thing about PHP is that the difficult problems have mostly been worked out. Getting a PHP site up and running and scalable is standard stuff.

If you can develop as quickly in PHP as you can with RoR, then you are not using RoR to it's full potential.
That is quite true. Even when using frameworks, PHP code is more verbose.

Also PHP has a proliferation of frameworks, so you may come across different frameworks in different projects reducing your efficieny. Since Django and RoR dominate in python and ruby respectively, the issue doesn't arise as much

I strongly disagree.

Maybe for a few classes of web apps, but if you know the LAMP stack well, you can create any type of web app you want in a flash.

RoR locks you down to building conventional CRUD sites.

I disagree based solely on the fact that there are multiple fully featured Open Source CMS's currently available that use PHP. No way anyone's coding (for example) a CMS faster than I can download and install a copy of Drupal, Joomla, or Wordpress.
Personally, I enjoy working with PHP, but only because I work with a platform/framework on top of it. I would likely steer clear otherwise.

While PHP by itself can be a challenge to work with, various frameworks and platforms abstract those idiosyncrasies while providing a significant increase in out of the box features and functionality.

For instance, NOLOH (http://www.noloh.com) is one such platform. Others such as Yii and CodeIgniter, while not as robust in certain respects, do a good job of this too.

(Full-disclosure: I'm a co-founder of NOLOH)

Coming from a Java background into a startup that was built using PHP, it's been my experience that PHP is difficult to scale. This is for two reasons:

1) PHP isn't long-lived. Every time a request comes in Apache launches the PHP processor/interpreter and runs through the entire script. This means you don't get a heap that you can use to cache things[0], you don't get the benefit of JIT compilation, and you don't get the benefit of pre-compilation[1].

2) PHP development always seems to be tied tightly to a database. At some point an extremely high-traffic app will need to scale beyond what a DB (even a sharded DB) can support. To do this you have to think in terms of asynchronous processing, out-of-process updates, aggressive caching, and more.

The second point isn't really an issue of PHP, but more an issue of the PHP ecosystem - however, it affects the way I perceive the language itself.

Places that use PHP for high traffic sites seem to use it to build the presentation layer, which seems to work for them, but the majority of the work is being done by back-ends written in some other language.

[0] Yes, you can use memcache, but it still means, at the very least, a cross-process hop and most likely a cross-network hop.

[1] Compiling to bytecode (for Java) is still better than no compilation. Also, you only take the hit of starting the JVM once, not on every request.

PHP doesn't scale? Facebook has > 200 million users. It's written in PHP.
The parent clearly talks about how PHP is used mostly for the presentation layer of that class of applications.