Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

PHP is not a bad language (or at least not as bad as some may suggest). I had teachers that didn't even know PHP was object oriented until I told them. I've had clients that immediately distrust us when we say we are PHP developers and question us for not using chic languages and frameworks such as Django or RoR, or "enterprise and solid" languages such as Java and ASP.NET.

Facebook is built on PHP. There are plenty of solid projects that power the web like Joomla and Drupal that are used in the enterprise and governments. There are frameworks and libraries that have some of the best architectures I've seen across all languages (Symfony 2, Doctrine). PHP has the best documentation I've seen and a big community of professionals.

PHP has advanced OO features such as reflection, interfaces, let alone that PHP now supports horizontal reuse natively and cleanly through traits.

There are bad programmers and script kiddies that give PHP a bad reputation, but power the PHP community at the same time, and because it is so easy to get stuff done PHP you can often do things the wrong way, granted, but why blame the language?.

Now, to boil this down to an actual answerable question: what would be a good and solid and short and sweet argument to avoid being frowned upon and stop prejudice in one fell swoop and defend your honor when you say you are a PHP developer?.

(free cookie with teh whipped cream to those with empirical evidence of convincing someone —client or other— on the spot)

P.S.: We use Symfony, and the code ends being beautiful and maintainable

P.P.S.: Facebook is written in PHP, compiled to C++ via HipHop and deployed on Hadoop. Here: http://arstechnica.com/business/2012/04/exclusive-a-behind-the-scenes-look-at-facebook-release-engineering/1/

share|improve this question

closed as not constructive by gnat, Jim G., Mark Trapp, Mason Wheeler, NickC Mar 18 '12 at 2:11

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

For starters, flag all snarky anti-PHP comments on Programmers. There's at least one PHP developer amongst the moderators who really loves to delete those... –  Yannis Rizos Mar 17 '12 at 4:19
Write good PHP code –  cspray Mar 17 '12 at 4:36
Just a note, I really HATE when PHP people bring the "FB is build on PHP" argument in. That's bs, it's built on massive distributed systems like Hadoop and the parts that really get stuff done are in C. PHP is used for templating and the UI, that's hardly enough to say "FB is built on PHP"... –  TC1 Mar 17 '12 at 8:23
@N.B. Yes, but in this case, IMHO saying that "FB is built on PHP" is like saying that StackOverflow is built on CSS and JavaScript, 'cause it has some nice UI touches here and there... –  TC1 Mar 17 '12 at 12:20
I would not hire you because I do not want to maintain PHP code. PHP is gaining features just like Perl and JavaScript and other rushed languages, but its very core has been designed in a hurry and one cannot change that. Perhaps you should consider learning some Django and RoR and Grails and thus be language-agnostic. –  Job Mar 17 '12 at 17:06

7 Answers 7

up vote 32 down vote accepted

The only answer I have is this: everything sucks.

You can find tons of arguments against OOP being any good (a quick search will reveal them) versus functional or procedural programming. You seem to indicate that PHP's OO support defends it.

Google blank sucks and you will find results for anything. Python sucks. Ruby sucks. Rails sucks. PHP sucks. Java sucks.

You want to know what really sucks? Programmers. Programmers suck. Any good developer should be able to create an amazing application, front end and back end, regardless of the language -- even if they were not familiar with the language! (That is to say, a good programmer should be able to learn and work with any language effectively).

Also note that the success of an application has nothing to do with its code. I've heard that Facebook code is awful, but by God is it effective. Same is probably true of Wikimedia (Wikipedia is built on PHP and is also an extremely popular website). What really matters is results!

PHP is the language that I am personally most familiar with. I will defend it to the death. I have worked with PHP frameworks, straight up PHP code, and PHP, python, and ruby (and even Java) all for web development. I can't say that one is particularly better than the other. What matters more is the developers and the algorithms. I have seen amazingly good and completely awful code in many languages (especially PHP since I have so much exposure).

Now for your question: it depends on who you're dealing with


They care mostly about results and cost-effectiveness. The fact that the very successful Facebook, Wikipedia, and Wordpress use PHP should be more than enough to convince them that it's an effective language for building successful applications.


Let your code speak for itself. If a developer says that PHP is inferior in some way, show them some PHP code that you believe to be effective. The proof of the pudding is in the eating.

share|improve this answer
+1 and a cookie. Well said. –  World Engineer Mar 17 '12 at 4:46
"Any good developer should be able to create an amazing application, front end and back end, regardless of the language" - repeat that after you've tried it in Malbolge. –  Michael Borgwardt Mar 17 '12 at 7:44
I don't think a good programmer can write good code in language he doesn't know. Decent, maybe, but not good. That's because writing good code in any language requires good knowledge of libraries and the language itself. –  svick Mar 17 '12 at 14:58
I disagree; a good developer should be able to familiarize themselves with the necessary knowledge to write good applications. Good knowledge of libraries and syntax is important, but that is something a good developer can pick up easily. What is much harder is algorithms and concepts (and probably patience)..even if the language is Malbolge. Or maybe I'm thinking of a great developer. –  Explosion Pills Mar 17 '12 at 15:29
success of an application has nothing to do with its code <-- True. But when people are saying that "PHP is a bad language", they don't mean "applications written in PHP are bad", rather, they mean "applications written in PHP are often not fun to work on due to code spaghetti". There are great applications written in PHP, to be sure. But I don't think this answer addresses what programmers mean when they call PHP "bad". –  Billy ONeal Mar 17 '12 at 15:51

PHP has a sordid history. It's much better now that it was even a short while ago, but there was a time, a very long time, where a lot of bad practices and patterns were encouraged and difficult to avoid. There is an entire generation of terrible PHP code out there that is still kicking around, and to the extent that new programmers are learning by reading old code, they're learning bad behavior. PHP may not now deserve it's blackend reputation, but it certainly earned it nonetheless.

Your best bet for defending PHP is to carefully distance and distinguish the current state of the art from the history everyone is familiar with. You can say that PHP isn't a terrible language, but if you're talking to someone who's been in the industry for a number of years, their memory tells them otherwise.

Show them how the PHP team has learned from their mistakes and changed the language for the better. Gone are the days of magic quotes and register globals. Gone is the global-everything paradigm, and safe-mode, and mysql_escape_string. Explain to them that real PHP programmers always use namespaces and parameterized queries, they avoid deprecated functions and always put their library code outside the document root.

PHP has changed, and PHP programmers have changed. Which is why PHP is the wonderful platform it is today. Also, it's the only platform that you know your customers will have pre-installed. That's huge.

As a side note, I'd recommend against citing existing CMS engines and frameworks as a big win for PHP. You run the risk of them pointing out things like the Websense security study from 4 days ago showing that 94% of recent website infections were against PHP websites running software like Joomla and Wordpress. That's not the sort of company you want to be seen with. Instead point out that your code will be way more secure than all that other stuff.

share|improve this answer
+1 -- but -- but -- Claiming that your code will be "way more secure" than code peer reviews by several professionals isn't really going to hold much water to anybody halfway experienced in security. Everybody writes security bugs. The trick is just to fix them one step ahead of the bad guys. –  Billy ONeal Mar 17 '12 at 15:47
@BillyONeal yep. The last paragraph is meant to strike you as a little... odd, and make you really re-think your approach to security. I did a lot of research on security of PHP vs non-PHP webapps, and the reports are disturbingly, massively skewed against PHP. That's not to say that PHP is bad, but security is a real concern. –  tylerl Mar 17 '12 at 19:11

PHP is the COBOL of the web. Both languages get no respect, yet many people make their living building and maintaining systems written in them, and they are present in volume in almost every major computer system for their native world (i.e., the web and commercial business respectively). Both languages are looked down on by practitioners of other, more popular, languages, based largely on old and obsolete habits practiced by programmers who have since learned better and improved their tooling.

PHP should be so lucky, that it lives COBOL's life. COBOL has been around longer than anything but FORTRAN, and it isn't going away any time soon. There are plenty of COBOL programs in daily use that are older than the people maintaining them. It may not be "the new hotness", but there will always be money to be earned working in and with it.

share|improve this answer

I think it may also be useful to understand the other side of the coin, and recognize PHP's shortages. While PHP has advanced a lot from being a template language, there are still many things that could be improved. There are some points where PHP is still lacking: Unicode, functional features, the organization of the standard library, the array and so on.

What I suggest is that - in order to make a constructive discussion about PHP strengths and weaknesses - it could be good to acknowledge all this. "Yes, I know that PHP standard library is not very organized. But if it was written today, it could make use of namespaces and object oriented APIs". "Yes, I know that the default array makes a little mess by mixing dictionary and array structures. But if one wants some better collections, one can make use of the SPL".

Your point of view will result stronger if you show that you know that the other people's arguments have some reason.

share|improve this answer

There is no short and sweet one-liner you can bust out to convince people of the worthiness of PHP and its developers, but you wrote a very convincing argument right before you asked the question.

share|improve this answer


Anyone who makes you feel you have to defend yourself (whether it's career, spouse, spending habits, etc.) is wasting their own time. You taking the time to defend yourself is simply humouring the wrong kind of people - now you're wasting your own time, as well as theirs.

Cut these people out of your life - you're better off without them.

share|improve this answer
So, the answer is to take it personal and ignore it?. This is a cultural problem, I'd rather address it and try getting my arguments better and more concise to shoot down ignorance. –  dukeofgaming Mar 17 '12 at 4:36
In a vacuum, I agree with your advice here, but PHP is indefensible. I always marvel at how Mark Zuckerberg succeeded in spite of PHP's awfulness: codinghorror.com/blog/2008/05/… –  Jim G. Mar 18 '12 at 8:32

In order to address the "PHP is a bad language", you have to figure out why the individual in question thinks it's a bad language. Maybe (s)he worked on a bad project written in PHP. Maybe (s)he just doesn't like prefixing their variables with $. Maybe they themselves have attempted to use the language and written unmaintainable mess. Many programmers coming from other programming languages see PHP and see a mess, because what makes sense in PHP does not really make sense in other language or on other platforms. For instance, in PHP, arrays are the "duct tape of the universe", and are used to accomplish pretty much anything, while in other programming languages such a thing would be absurd.

I would suggest a combination of the answers here.

  1. As tylerl said, you have to show that modern PHP is significantly better than it's older cousins. Gone is the nastiness of create_function. Gone is the jungle of calling include manually everywhere.
  2. Acknowledge that there are faults in PHP. There are faults in every programming language. Saying otherwise will make many serious programmers completely ignore your response as being a "fanboi".
  3. Show people things that are easy in PHP that are difficult in other programming languages. Programming languages are designed to make some tasks easy, which necessarily makes other tasks hard. C? Memory manipulation and bit hacks are really easy, and the language is really simple, but maintaining large applications is hard. Java? Doesn't have free, and everything is "OO-ish", but the runtime is large and OO can be limiting. C++? Lets you make types that behave exactly like primitive types (e.g. int) in the language, but that comes with large amounts of complexity. PHP? Makes it really easy to start off without much programming knowledge, but as a result has lots and lots of garbage code posted on the internet.
  4. Acknowledge non-language advantages of PHP. There are still many things in PHP, as a language that can be... annoying to work with. But it's easy to configure, easy to deploy, and comes with a large set of great libraries that you can "plug in" to without much additional work.

There's a place for every language. Choose the language to suit the problem at hand, don't try to shoehorn a preferred language into places where it does not belong.

share|improve this answer
-1: Why are you trying to defend PHP? It sucks: codinghorror.com/blog/2008/05/… –  Jim G. Mar 18 '12 at 8:29
@JimG.: Because that's what the OP asked me to do. I'm playing devil's advocate here; I really despise working with PHP myself. But just because a system is annoying to work with does not mean that there are no good things about that system. One can learn even from major f*** ups. :) –  Billy ONeal Mar 18 '12 at 22:55
@BillyONeal Why do you hate working with it? Deciding on things myself. –  johnny Oct 21 '13 at 3:27
@Johnny: Mostly, just being a scripting language which is ill suited for building large systems. Scripting languages are great for rapid prototyping, ease of deployment, and come with large standard libraries in the box. But building large systems with them often results in unmaintainable mess due to an inability to enforce compile-time checks and constraints. The very things that make PHP flexible and good for scripting scenarios (e.g. variables are untyped) make it difficult to build systems with more than a few people using a component. –  Billy ONeal Oct 21 '13 at 4:21
@Johnny: To clarify -- I'm not saying that building large systems with PHP is impossible -- Facebook and Co. are proof positive that it is very possible. Just that it ends up being more difficult than with languages that provide better compile time syntax and semantic checks. –  Billy ONeal Oct 21 '13 at 4:21

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