Hacker News new | past | comments | ask | show | jobs | submit login

People hate on PHP for a number of reasons, and that's why it's unusually unpopular. Here's my (highly subjective) take on why.

The barrier to entry for that language is extremely low, that is anyone who can manage to FTP a file to a server that has a bit of PHP in it can as much as consider themselves a "PHP programmer". This means there's an awful lot of extremely low quality PHP code out there written by people who didn't know better.

Secondly the language itself is so dizzyingly confused, where there's literally thousands of methods in the root namespace, and there's no pervading design pattern. Arguments appear in random orders, terminology changes, and functions from C, not exactly known for being programmer friendly, are simply ported, warts and all.

Then there's the problem with deployment, where PHP hosts usually have a woefully out of date version of PHP and many of the extensions that are standard have been disabled for reasons that are never entirely clear. This means writing PHP code that can be deployed on more than one host is extremely frustrating, often leading to writing it for the lowest common denominator just to avoid support issues.

Plus, there's this pervasive attitude amongst the PHP developers that frameworks are a bad thing, leading to enormous amounts of badly written re-inventions of things. People constantly write their own third-rate ORM, implement user authentication that's practically a check-list of what not to do, and seem to have a talent for mashing together different concerns in the same file.

This boils down to a nearly complete lack of leadership in the PHP world as to "how to do things properly". So long as the poisonously bad, brain-damaging w3schools is the go-to source of knowledge for PHP developers, things will only get worse.

If you like PHP for whatever reason, and surely some people do, the most important thing to help promote that platform is to be vigilant about stomping out bad development practices and setting a good example for other developers by explaining how to do things correctly using modern techniques.

This sort of outreach is taken for granted in the Python, Ruby or Perl communities which go out of their way to support aspiring developers. In the PHP world, it's full of nomads that prefer to go it alone.




Hmm, I think there is a lot of truth in this.

I came to PHP late in my developer life (I started in the 80's when I was a kid) and didn't touch PHP until ~2009.

I've always used the current leading frameworks (or something close) and written PHP like I'd write Python or Object Pascal (clean, clear, commented, separation of concerns) so my opinion of PHP is probably clouded because of the way I approach it.


The thing that burns me the most about PHP is a worryingly large number of people using PHP think it's perfectly acceptable to start a project by opening Notepad and typing in "<?php $db = mysql_connect(".

From there on it's only misery. It's like new developers start out using techniques that should've died in the 1990s and the only reason they do this is because they don't know any better.

In the Ruby world you'd have to be living under a rock to not know about Rails, and the same goes for Python with Django. You're developing a web app? You use a framework. Period.

Yet in PHP land you have people who are otherwise competent developers that just don't know how to develop a web application. Maybe they've come from Java and they think that writing PHP like that is clunky, but hey, everyone else is doing it so who's to say otherwise, right?

If you like PHP and want to help, call people out when they're doing it wrong. Give them guidance on how to do it properly. Don't just look away and pretend you didn't see them flailing away on re-inventing the wheel.

I'm not even a PHP person but I've been pretty vigilant on the MySQL section of Stack Overflow about petitioning against the use of the deprecated mysql_query extension, pushing people towards PDO or ORMs, and about how important SQL escaping is. This feels like Doctors Without Borders where I'm explaining to a community that boiling water to kill parasites is important.

The PHP world is in really bad shape if people don't even know the basics.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: