It's like this mythical thing that a dominating portion of developers say is just the best option for back-end development, a part of development about which I know virtually nothing beyond the absolute basics.

So I've looked up PHP tutorials a bunch of times, trying to figure out why it's so powerful and common, but it's annoying as hell-- all the tutorials treat you like a new programmer. You know, this is how you make an If Else statement, here's a for loop, etc. The "Advanced Topics" show you how to make POST and GET statements and whatnot.

But there must be more to it! I don't get it! That's practically no different from JavaScript. What am I missing about this language? What else can it do? Where's the power and versatility? I've heard it called a function soup; where are all the functions?

Please chide me. I'm clearly missing something.

  • I think most developers would agree PHP is not the best option for back-end programming, so I disagree with the premise. Sep 11 '12 at 12:42
  • 13
    In the 8 hours since you've posted this, I've written a small commercial site (from scratch, no frameworks), and a couple of modules for a large web app I'm working on, that would have taken me at least two days to write in the other language I usually work with (Java). That is, for me, the true power of the platform, while the rest of you are here arguing about language design, fractals, purity, whatever, PHP developers are actually building and deploying awesome stuff.
    – yannis
    Sep 11 '12 at 13:57
  • 3
    @Aerovistae: You ask for opinions to the contrary, Yannis gave you one, and you tell him he's wrong? We can all agree php has a lot of problems and it does tend to foster bad habits, but I notice people who realize it's limitations can get some cool stuff done - the type of people who tend to dwell on this probably don't build anything of substance no matter what the language in question is. Sep 11 '12 at 17:26
  • 1
    You can build awesome web stuff in any language that has strings, file i/o and sockets support. I have learned never do dismiss someone for her choice of language as long as she is smart and knows her stuff. Sep 11 '12 at 18:11
  • 1
    Even the worst tool looks good in the hands of a master craftsman. PHP has a (IMHO) well-deserved bad reputation, but it doesn't mean you can't get the job done in PHP.
    – K.Steff
    Sep 12 '12 at 1:35

PHP is terrible. For more information you can check Php a fractal of bad design I have been working with it close to 13 years now, the last 5 not as a hobby, not even dared to jump deep into its OO capabilities, and I am still finding bugs, gotchas, ahas and plain insane behavior on daily basis.

So if you want to find something unique in PHP that elevates it beyond the other languages - there isn't. So why it became the alpha dog then:

  • You have no choice - unless you start a project from scratch there is usually something already written in PHP that works. (inertia)

  • It was extremely easy to prototype and iterate - this is more of a historical reason, there are other languages that are good at that now, but c. 1999 there weren't many of them.

  • Played nice with apache, mysql and was free - maybe the most important thing in this list.

  • Hosting was easy to find

  • Easy database access - there were dark times when there were such things as DAO with wild recordsets out to get you. For a mfc developer the idea that your whole DB layer was mysql_connect, mysql_query with simple sql was a godsend.

  • Simple tool for a simple task - php is really good at getting data from a DB and putting it in a punched hole in your html. And at the dawn of time that was website development.

  • 5
    Lots of stuff that already works, easy to prototype, free, works well with apache & mysql, hosting is plentiful, easy database access, and was good at exactly what was needed for -web apps. That sounds more like a sales pitch for PHP, rather than 'terrible'. Sep 11 '12 at 6:38
  • 3
    That "fractal of bad design" article makes some good points, but is mostly full of nonsense and incorrect assertions. Sep 11 '12 at 9:08
  • 1
    I completly agree with the answer AND the comments that follow it. The cited article has a good portion of questionable facts, but then there's also a good portion of true facts about the issues PHP has. I've worked with it and would work with it again if there's no choice, but if I'd have a choice I'd prefer Java, .net, Scala, over it. Sep 11 '12 at 10:00
  • 7
    @GrandmasterB It is a sales pitch. But it stops there. These are essentially PHP’s only good features, the rest is unadulterated crap. Sep 11 '12 at 10:08
  • 4
    I really, truly, hate "PHP: A Fractal of Bad Design". When it was posted on Hacker News a few months ago, I wrote that I lost all my respect for the author after he snobbishly belittled me and called me an amateur just because I used a certain language: "So I have to fit this in here, because it bears repeating: PHP is a community of amateurs. Very few people designing it, working on it, or writing code in it seem to know what they’re doing. (Oh, dear reader, you are of course a rare exception!)" Sep 11 '12 at 14:12

The big reason for PHP's popularity can also be attributed to its ease of use. Anyone (quite literally) can program simple PHP after checking out a few examples of code and trying it a few times. Other web programming languages require a whole lot more effort to create even the simplest of programs, and barring C and Java, there's not much in the way of online examples. Most people don't want to install humongous IDEs, build a dedicated web server, and arrange for a DNS, when all they want is to spice up their website with some extra features. Perhaps they have heard enough horror stories about Javascript that they want to use something else.

In comes PHP. No IDE required, just any regular text editor that comes pre-installed in pretty much all computers. Then just upload a couple of files to a web host, maybe adjust permissions for a few files, and that's it. Fire and forget, if you please. Certainly not pretty or elegant, but it works and is quick. Testing is just pressing F5, without any compiling, delivering, and deploying.

For something more elaborate, just a quick install of WAMP/LAMP, and change a couple of settings in a text file, and off you go in the comfort of your home computer in an environment that is almost "real", so you can easily see the changes on the fly.

I highlighted a few points which I feel are the biggest reason for PHP's popularity.


Check out http://www.php.net/manual/en/

It's tough to really list all the things you can do with server-side code over client-side code, although if someone else made such a list I would find it really interesting. It's certainly very easy to think of things that you should do on the server-side, since on the client side anyone can read and modify your code.

  • The Security, Features, and Function Reference sections have everything I needed. Chuckle. Too easy. Sep 11 '12 at 5:05
  • not php specifically, but any server side language has a big impact on what you can do.
    – deltree
    Sep 11 '12 at 12:09
  • Yeah, based on the line "That's practically no different from JavaScript" in the question, I figured the author might be failing to understand the critical distinction that PHP is server-side and JavaScript is (mostly) client-side. Sep 11 '12 at 21:18
  • Oh no, of course I know that. That line indicates my main point here...I didn't see what makes php so special as a server side language, what really makes it any different from the client side. Sep 11 '12 at 22:07

I think the main advantage of PHP, at this stage of the game, is the huge collection of frameworks, libraries, utilities, templating engines and extensions, all designed around server-side internet applications. Similar to how Java had, for years, a very wide ecosystem of tools that made it more interesting than C#, for instance, despite the fact that the language itself wasn't as good as C# (IMO).

It's a bit of a chicken-and-egg situation, since the value of PHP is in its popularity, how did it get so popular? Well, that's a combination of factors, including low barrier of entry (like VB in the 90's) due to being very flexible about the code it accepts, no matter how ugly, and a lack of language that were really web-app driven when it started.


The language itself is not very exciting, the functions are "grown organically", you probably have heard of the inconsistencies in parameter order.

The power for backend development comes in when you don't do everything yourself but use one of the existing (PHP 5.3) frameworks. I recommend Symfony 2, but also have a look at Zend Framework, CodeIgniter and CakePHP to see if their framework style fits with your programming style. You'll get foundational stuff like session handling, caching, authentication, separation of data, presentation and action layer (MVC), etc.


A number of reasons:-

  • Shallow learning curve. Its easy for beginners to write a simple working web site.
  • Pricing. Its really free as in beer.
  • Freedom. Its truly open source, this encourges a large development community.
  • Packaging. The projects such as XAMP provide a complete working web server and development environment will all the libraries, databases and tools most developers will ever need.
  • While there are features that annoy CS graduates the language is actually pretty nice to work with.
  • Focus. The language developers, the library integrators, almost everybody involved in what is a very, very large development community has a single focus -- build a working web application with the least effort.
  • Documentation. The documentation/wiki on the PHP web site is probably the best example of how to do on-line documentation. Well organized, searchable and full of user provided samples and hints.
  • -1: Pricing. Its really free as in beer. Incorrect. PHP is free like a free puppy. "It takes years of care and feeding. You don't get to criticize a free puppy that you bring in to your home." codinghorror.com/blog/2006/08/open-source-free-as-in-free.html
    – Jim G.
    Sep 12 '12 at 1:51
  • 1
    @Jim G. -- you can write bad code in any language, and, there is a lot of bad php code out there, but there is a lot of worse Java code. You could argue that C++ is better because it takes a level of expertise just to get the code to compile. Sep 12 '12 at 6:18
  • #Jim G. "Its free" is for sure one of the reasons why php is so popular. I think ColdFusion was the only paid for development language that ever got any serious web server market share and its a lot worse than php! Sep 12 '12 at 6:21
  • "It's free" is for sure one of the reasons why PHP is so popular. - I'm not disputing that. I'm just saying that it's free like a free puppy. Not like free beer. Please click on my link above.
    – Jim G.
    Sep 12 '12 at 11:45
  • I think Coldfusion was the only paid or development language that ever got any serious web server market share - Define market share. If you're including every mom and pop website developed in somebody's garage then I wouldn't be surprised. On the other hand, if you consider enterprise Internet and Intranet web sites, and consider how much revenue they're responsible for, the discussion changes a bit.
    – Jim G.
    Sep 12 '12 at 11:51

You mentioned "That's practically no different from JavaScript". Certainly allot of common languages like C/C++/C#/Python share similar syntax.

However the bigger difference compared to say Javascript is that it's most commonly used on the server side hence you can interact with a database, create an authentication system, manipulate images etc.

  • "Most commonly used on the server side" .. as in.. all of the time? Sep 12 '12 at 2:26
  • Perhaps I used the wrong word, by 'server side' I mean to say 'web serving' environment. Sep 14 '12 at 4:46
  • @Chris "Most commonly" means in this case always. Or the other way round: It absolutely never runs in a browser. PHP is used to generate static HTML, to run code in a client, you still need to use JavaScript. Oct 2 '12 at 18:02
  • Wouldn't you classify PHP command line scripts (CakePHP's bake for instance) as not being 'server side'? Oct 4 '12 at 8:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.