Everybody knows that people that have prejudices against certain programming languages. Especially PHP seems to suffer from problems of its past and some other things (like loose types) and is often called a non-serious programming language that should not be used for professional applications.

In that special case PHP: How do you argue using PHP as your chosen programming language for web applications? What are the benefits, where is PHP better than ColdFusion, Java, etc.?

  • 5
    PHP is a regionalized, minimally-invasive approach to cancer treatment currently undergoing Phase II and Phase III clinical testing. PHP can also help understand hash collisions better. The PHP project organizers also help various law enforcement agencies combat private and commercial unsolicited bulk mailing offenses and overall work to help reduce the amount of spam being sent and received on the Internet. PHP offers support groups in several dozen locations across Massachusetts. PHP is a type of program used to treat mental illness and substance abuse. PHP is in Layer 3 MPLS VPN (RFC2547). – Job Jan 12 '11 at 16:21
  • Every language has its haters/admirers. I would not say that PHP is especially hated compared to other languages. Infct I would say that the more admires a language has the more haters it has. I am sure we could codify that: (admirers lang X/haters lang X) = AcmeConstant . AgeFactor(Lang X Age). Where AcmeContant is unchanged for all languages <(;-) – Martin York Jan 12 '11 at 17:51
  • 1
    I use php to demonstrate to people how not to design languages. – dan_waterworth Jan 12 '11 at 20:06

Josh K has pointed out some pretty good points, so I wont reiterate that. Instead I'll add some more.

It's interpreted.

Just FTP/SSH into your account, change the stuff needs to be changed and presto! No need to compile, to deploy, to restart the server.

Of course this is something that is compelling for people working in non formalised development environment, with no version control, automated tests, automated builds etc.

It is in fact easy

Seriously. At least for the real beginner it's really easy. So easy that when my cousin expressed an interest in learning how to program, I bought him a Python book instead. PHP's conventions might teach you some bad habits.

It is capable

I have a life long, mutual feud with C/C++ languages. Somehow we don't like each other. While at university, when I had to do projects involving computations, I would choose PHP over C++ and in each case I could achieve what I intended. Maybe the program execution was in fact slower than if it was written in C++, but it was not a factor in this case.

Anyway: neural networks, genetic algorithms, fuzzy logic... I did all of these on PHP. Yes... people had been telling me I was weird.

| improve this answer | |
  • +1 for interpreted and capable. One thing that always bugged me about doing web work with Java is the constant need to recompile and deploy. Using something like Grails alleviates some of this, but it's nowhere near as good as PHP. – Josh K Jan 12 '11 at 19:53
  • Interpreted and capable is really a good argument. +1 All answers were good and hit some good arguments, but yours sum it up quite well. – acme Jan 27 '11 at 14:16
  • Just look at this code for dealing with 64bit integers: mysqlperformanceblog.com/2007/03/27/… Do you seriously call this easy? – ThomasX Nov 17 '11 at 8:47
  • No I don't. Please note I wrote: 'At least for the real beginner it's really easy.' Real beginners usually don't need to bother with portability between platforms (if it's a good thing - that's quite another question). General advice: if you expect to deal with large integers in PHP use BCMath extension (and yes, I know this isn't the best solution there could be... but that's how PHP is ;) ) – Mchl Nov 17 '11 at 13:05

This is something that not everyone is going to agree on but I think that another reason that PHP is so popular is because it is easy to obtain a free hosting account.

Many young students who wish to get into web development choose PHP because setting up a server online will cost them nothing and so they can play around with it / learn about it for free.

Although there are free hosting options for other languages (java, ruby, .net), they are much harder to come by.

| improve this answer | |
  • Cost is definitely a major factor in the widespread use. – Orbling Jan 12 '11 at 16:54


PHP has templating built in, with no weird tags, parsing, or overhead. Some like this, some don't.


PHP can be run for almost every server and most platforms. In fact it is run on most every server. You can run it under IIS, Apache, Nginx, etc. This means you have a write once - run anywhere portability. This portability does come with some restrictions, depending on the environment settings you have to support. This will differ between commercial applications and open source / widely spread applications.


PHP has a huge community and it's still growing. This community is a result of the large popularity of PHP. You have very active mailing lists, discussion forums, and a large number of people who can answer questions when developing.


PHP itself is free, and the majority of items it works with out of the box (Apache, PostgreSQL, MySQL) are free. This gives your project a very low initial cost threshold.

| improve this answer | |
  • I wouldn't really say that portability was a strong point of PHP's. If you want to actually write portable PHP, you have to work around the fact that the language can be configured lots of different ways, e.g. you have to check the config option for magic quotes and run stripslashes() because some have the config option on and some don't. – Jim Jan 12 '11 at 16:37
  • 2
    @Jim - That's a lot more portable than most things. – Orbling Jan 12 '11 at 16:54
  • @Orbling - Really? What similar features of other languages are you thinking of? – Jim Jan 12 '11 at 17:42
  • 1
    @Jim: I write code that expects a "best practice" environment. If I was doing an OS project I would mandate a number of options / settings (for example, magic_quotes_gpc turned off). The best way to deal with this (if you had to) would be to encapsulate these if / else processing blocks into helper functions which would eliminate the need to inline the quotes check with your application code. – Josh K Jan 12 '11 at 19:02
  • 1
    @Josh - I would do the same as you if I still wrote PHP in any large amounts these days, but if your code depends on a "best practice" environment, it is not portable. Specifically, it will have data corruption bugs on many crappy hosts as spurious backslashes are added to all user-provided data. Given that the ubiquitousness of PHP hosting is held up as one of the main advantages of using PHP, I think it's fair to take all those crappy hosts into consideration. The helper functions you describe are the typical way of dealing with it, but that is a workaround for a portability problem. – Jim Jan 12 '11 at 19:12

PHP is everywhere. No matter what crazy weird webhost you have, it's highly unlikely not to have PHP installed on it. This means if you're writing a web app which has to run on other people's servers, you can always depend on some set of PHP features (PHP 4/5 classes and the default extensions) and increase user base while decreasing support.

| improve this answer | |

Availability Almost every webhost supports it

Speed of development All you need is a text editor, no compilation required

Easy to setup Even if it's not installed, it's easy to install, even comes prepackaged with LAMP/WAMP servers

Documentation There are tons of examples, support groups, books, etc.

| improve this answer | |

Some advantages of PHP:

  • Built-in file input upload handling
  • Built-in handling of data from GET, POST, and COOKIES
  • Built-in Session management
  • Quick to write
  • Easy to mix code and HTML (note: this is also seen as a disadvantage)

Now, it also has several glaring disadvantages:

  • No concept of local variables... variables are either global or function scoped. This will burn you at some point, particularly if you're using loops.
  • Global variables aren't available in the function scope unless you specifically ask for them with the global keyword.
  • The programming environment changes based on php.ini. This includes changes in the behavior of specific functions and built-in arrays (e.g. $_GET and $_POST values changes based on the magic_quotes_gpc setting)
| improve this answer | |
  • 1
    No one in their right mind would keep magic_quotes_gpc turned on. I question the sanity of the person that added that worthless bloat to the engine in the first place. – Josh K Jan 12 '11 at 20:00
  • 1
    "Global variables aren't available in the function scope unless you specifically ask for them" - don't really see how that's a disadvantage. There are languages that do it this way, there are others that do not. – Mchl Jan 12 '11 at 20:22
  • 1
    @Mchl: Most languages don't do this, and it's a definite gotcha if you don't know about it. Off the top of my head, TCL is the only other language I've used that does this. – Powerlord Jan 12 '11 at 20:26
  • 1
    @Josh K: My previous company's primary server still has it on, as the head programmer before me liked it, and as such most of the old legacy PHP code floating about relied on it. No time to recode hundreds of websites. :-/ – Orbling Jan 12 '11 at 20:44
  • 1
    @Mchl: Ada tends to get used where failures would result in death, lots of death. adaic.org/advantages/projects – Orbling Jan 12 '11 at 22:11

I think some people dislike PHP because you can use it the way you like / see fit. Because everybody can use it very easy a lot of crappy code gets in the world. Some programmers who never done any real PHP there selfs may think it the way you work with PHP. And some people dislike PHP because they like something else and are afraid to new things or so.

I personally like PHP because i can run it almost anywhere. You can get a lot of help around the web and it's free. Also there are some good frameworks like the Zend Framework. But most people can't get there heads around it.

| improve this answer | |

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