I am a student at university and I want to get in touch with web development. But I don't know which language I should learn. I have a strong C++ and Java background.

I tried JavaEE but it's difficult to host JavaEE Projects. Almost all server hosters run PHP, (python, perl). I would like to start with PHP.

The Question is : Should i start learning PHP?

The Pros:

  • most Ajax examples work with PHP
  • server hosting

But I am afraid to start learning it, because it is considered harmful. at least its [ed.: by some] considered to be horrible.

Should I learn something else?

+20  A: 

but i am afraid to start learning it, because it is considered harmful.

[citation needed]

You can do dumb stuff in PHP, just like in any other language. You can do brilliant stuff in PHP, just like in any other language. If you want to learn PHP, do so - it's a useful, commonly used language that can serve you well as a career if you become good at it.

I'd like to diss PHP as much as the next Perl guy, but ceejayoz is 100% right. Some languages are indeed harmful (original BASIC anyone?) but very few actually are - only people programming them can be harmful.
BAIC might be an apt comparison, since it's the only language other than PHP that I'm aware of that has an easy way to say "quietly ignore any errors in this and proceed". The only difference is that in PHP, it's even easier than it ever was in BASIC - it's a single-character operator `@`... ~
Pavel Minaev
+2  A: 

Humorous answer: No. I'd suggest using Python (and Django).. or Ruby (with Ruby on Rails)

Seriously: PHP is okay for smaller things. The one great advantage is that it's installed everywhere. The disadvantage is that it's configured differently everywhere, and behaviour changes over version changes sometimes.

Dave Vogt
'smaller things'? .. some of the biggest websites out there is done in PHP .. Facebook for example.
Derek Organ
You're right, i might be biased by the amount of really bad code i see on a daily basis. But still, if you plan for something big, I wouldn't use PHP, for the reasons mentioned. And even the Facebook guys say it's not very comfortable at their size (and they're using way more technologies than just PHP)
Dave Vogt
Is anything particularly comfortable at Facebook's size?
+28  A: 

PHP, Python,Ruby, and ASP are all fine choices for a server side environment, it's really up to personal preference.

And if you want to get started in web development, I'd recommend getting a good solid understanding of HTML and CSS first.

So true. You can be great at any server-side code, and still suck at web development without html and css (I'd add javascript to that list as well)
Gordon Tucker
good point. Getting a good foundation in JavaScript is a necessary skill to have as well for a web developer.
I've been stuck with just HTML/CSS for years now until a few months ago and I started trying PHP. I agree, the fundamentals of web development are essential. I have yet to try ASP but it seems like it is pretty solid. Just take the time to try each one for a bit and see which one you like best.
Nate Shoffner
And yet, some animals are better than other, and there are objective criteria on which languages can be compared. PHP has its reputation for a reason.
Pavel Minaev
I would just knock ASP off that list. I don't see it as something worth knowing going forward because it has some serious limitations and MS has superseded it with .NET.
@Pavel That reason is not that PHP is inherently bad. That reason is that it's usually the initial language of choice of newbies and thus lots of bad code is out there. If that were a reason not to use a language, the fact that many, many stories/novels are shitty would be a reason not to use books.
PHP language design _is_ objectively bad at places. See my comment to another answer.
Pavel Minaev
I suspect **every** language is objectively bad "at places".
+1 for HTML/CSS. The one thing I dislike about .net is it seems to want to hide HTML from you.
Yes, but some languages have more such places than others. I really don't understand why there's such heated counter-argument to a simple objective fact that PHP language has an unusually large number of design flaws in it compared to most of its competitors. It may have other benefits (like popularity / being widespread), but design clearly isn't one of them.
Pavel Minaev
all these comments are exactly why I didn't specify a preference for a language. Everyone has their own opinion about it. There are pros and cons to any of the language choices I mentioned.
+2  A: 

On the topic of PHP being harmful:

The language itself isn't harmful, it just has a very low learning curve and as such comes a plethora of bad developers that misuse and abuse it. You have to be wary of tutorials and articles as a high number of them are not coded using best practices or with security in mind. It's up to you as the developer to handle such things, plug security holes, etc.

This is completely biased- there are a lot of way to make a living as a programmer that do not involve the ms stack
I work almost exclusively in LAMP for a Fortune 500 company. The MS stack isn't the corporate powerhouse it used to be - open source is making quite a bit of headway.
I constantly hear that it has a low learning curve. This is not true, I'd say it has a very high learning curve because it has a very low **barrier of entry**, meaning that you can generally start churning out low-grade mush and weapons-grade stupidity on day one. Because it seems so easy, a great many PHP Users (not PHP Developers, mind you) don't ever learn how to do things like use BCP, handle Exceptions, manage security risks, and so on. These same people decide they are experts and go on to write tutorials, teaching others to be just as mediocre as they are.
+3  A: 

I say yes. I just started learning it a few months ago. I instantly fell in love with it. Even the simplest things such as Include() make editing multiple pages easy. It's a very common language now days and there is a lot that you can do with it. Sure you can do "harmful" stuff, but that goes for just about any programming language. Give it a try, you'll like it. ;)

Nate Shoffner
+2  A: 

If you want to be a web developer you're going to have to learn many languages. You're not always going to be hired to build a brand new project from the ground up.


PHP is OK for web-only development. It has its detractors and its supporters. AFAIK, it's not used much in corporate environment, but it's a personal impression, I welcom someone to correct me.

Perl is great for web development, and the benefit is that you can use it outside of web development as well in your further programming career.

PHP is used by Facebook, the White House, IBM, Sony, and many other corporate environments.
White House! The paragon of sound judgement! :)

Why not start with RoR?

by 'sophisticated' I meant that it does not stand for spaghetti code. In rails, the code will be better encapsulated, standards will be well defined, you can do a lot with less lines of code.

In the end, good code vs. bad code always depends on the person writing the code. At least in the case of Rails or any convention over configuration framework it is hard to write spaghetti code.

More sophisticated is a pretty subjective statement to make.
I'd say that is pretty objective when compared to "vanilla" PHP.
Dan Diplo
You'd need to start by explaining what makes a programming language "sophisticated".
Smoking cigarettes is sophisticated. That doesn't make it good for you.
Spike Williams
>_< sophisticated explained!
+3  A: 

I think you should put emphasis on learning, rather than the tools you use to learn. If you're a smart dude then you won't only know PHP, you'll be a language polyglot.

Gotta start somewhere though, and if PHP is the easiest road, then I suggest you take it. Just don't get bogged down and think that the PHP way is the One True Way.


PHP is not a very difficult language learn. If you have used c in your c++ work, the base libraries should be very familiar. If you take the good practices you hopefully have learned in java and try to apply them in PHP you will avoid most of its pitfalls. The biggest reason (IMO) that PHP has the bad name is that many new programmers hack together PHP monstrosities based on copy pasting code from various examples without having any grasp on good application design or security practices.


If you've already got a Java background, I'd suggest you stick with that stack for web development. You don't have to learn all JEE, but the basics of servlets and JSPs will get you pretty far, then you can start learning frameworks like Spring.

This is not to say that PHP is a bad choice, just that I think its best to build on what you already know, rather than have to start fresh with a brand-new language.

If its hosting you are worried about, look into Google App Engine, which now supports Java.

Spike Williams
+6  A: 

I wouldn't recommend PHP as a first language, as it can easily lead to too many bad habits. However, in the hands of an experienced developer it's a productive tool. Now, if you have a strong C++ background then you will probably be more aware of the weaknesses of PHP and thus, hopefully, will not be drawn into those bad habits. It will give you a good introduction to web-development, as it's ubiquitous and easy to get going with.

However, as an ex-PHP developer, I can honestly say there is a lot about PHP as language that is quite horrible! Be aware of that, and you will be OK.

Dan Diplo
+1. I dabble in PHP and I like it, honestly I do. But there are some things that are just awful (library function naming "conventions" anyone?)
@MarkJ: PHP seems to be moving away from a lot of those now (e.g. with new database and XML classes). However, any failing in the library naming conventions is greatly counter-balanced by the fantastic documentation.

I say yes, It's Easy to learn and easier to deploy since you don't need to do anything on the server 99% of the time, unlike rails, python, java or ASP. And it's completely free.

And from my own personal experience, I'm in the UK and I've been developing websites for 9 years now; I've never met another developer in the wild (as in, actually spoken to face to face) who uses anything else for server side stuff, nor have I seen any other server side language specified on any of the job vacancies I get sent. And I work primarily for the "big corporate clients" that people always go on about, so I don't really understand the notion that open source isn't popular in the enterprise environment.

I'm not saying people in the UK don't use other languages, they clearly do, but PHP seems to be the weapon of choice from where I'm sitting.

+1  A: 

I think a good programmer can create a good system in most of main stream technologies.

The question is what you hope to get out of it.

I think the main 4 options are

  1. .NET/ C# -


C# is a very nice language and easy to learn if you know Java Tend to be the best paid developers

Disadvantage: Windows hosting can cost more for licences etc.

  1. LAMP e.g. PHP


It is the most popular language out there.. loads of support and libraries Very web orientated. Open source and mostly cheap hosting


Lots of bad programmers/ bad habits in the way people code PHP (frameworks can help) More competition to get lower paid jobs

  1. RoR - Ruby / Django -python

Advantages: Very nice but different language to what you would be used to. (a good thing.. widens you knowledge base) RoRScaffolding and code allow you to build prototypes very quickly Python -Google uses it in a big way

Disadvantages not as big a community... libraries etc. ...

Point is.. I think you can have a pretty successful career in any of these. Personally if i was you I'd pick .NET.. more money in it but i'd defo learn one of the other ones at some point too.

Derek Organ
+10  A: 

With respect to web development I think is easier to think in terms of stacks.

The clear stacks IMO are:

  • C# / / IIS / Windows
  • Java/J2EE/Apache/Solaris
  • PHP (or Python) / Apache / Linux
  • Ruby / lighttpd / Linux

Any of those stacks will help you to develop a successful web app. And each one has its own strengths.

When selecting the stack you must consider that with it comes a 'culture'. So which one to select? The one where you have most experience with. Since you mention you have a strong C++ experience you will feel pretty ok with PHP.

Strong C++ experience probably does help with PHP. But the OP also has strong Java experience. I'd suggest Java and C# will also feel equally OK. +1 for stacks though.
@MarkJ correct. Although it is useful to remember that OOP in PHP is heavily influenced by Java. This comes from a collaboration agreement that Zend and Sun had a few years ago (before php5). And is easy to see from the scripting languages (perl, python, ruby) PHP's object model is the most similar to Java's
+1  A: 

I had to forcefully learn PHP as I was going to host an application in a company that would only run PHP applications. It was useful to learn it, but you have to keep in mind that PHP is a language that makes easier to write bad code - so you have to take care to maintain things properly and to write good code.

Ravi Wallau

I started web development with PHP (with very little programming experience). If I could do it all over again, Python would be my language of choice, then PHP.

Your situation is different. You have experience in Java/C++ so OOP is nothing new. Yes, you should learn PHP. Consider learning Python on the side, or vice versa.


If you know C++ and Java, picking up the basics of PHP should take you about an hour, and thanks to the extensive online documentation, it's a skill you'll always have with you as long as you have an Internet connection. That alone will get you started in Web development. If you plan to stick with it you might want to dive into one of the other platforms later (although maybe not; some of the most heavily-used software in the world runs on PHP).

+4  A: 

Just to throw in my two cents, I actually do PHP development for a living, every day, in a real brick-and-mortar shop (as I'm sure many do, but this is important).

First, it is absolutely fundamental to have a good HTML/CSS/JavaScript foundation that should include an understanding of browser differences, box model, AJAX from the client side (And therefore the concurrency-with-a-twist that is asynchronous web requests), and Document Object Model. Of course, there's no reason you can't learn all this concurrently as your learn PHP, but you must learn it or you will suck.

Now, if your C/C++ background is strong, PHP will be an absolute cake walk -- there will be almost no learning curve (syntactically; semantics is another deal, of course), you will recognize where PHP's weaknesses are, and recognize that they are mostly technique-based; being smart, keeping your head about you, and keeping your goals first and foremost will help. Do a bit of research on the history of PHP and why register_globals was a horrible idea, so you don't repeat the mistake and write something like this:

foreach ($_POST as $pkey => $pval)

If you write good code, it will show no matter what language you use (except for original BASIC, of course). Always remember, to avoid bad habits, pretend that the next person who will maintain your code is a psychotic, murderous PHP wizard who knows where you live. This will keep you using BCP and not just copy/pasting the same horrible code everywhere, which will in turn make your own life (maintenance-wise) much more productive and enjoyable.

Finally, please ignore the massive naming inconsistencies, there are reasons for this that will become clear if you read up on PHP history (esp. versions 1-3); they may not be good reasons, but they are reasons. Also, Unicode can be a big "Gotcha!" when writing PHP web apps -- if there is any chance anything other than good old single-byte ASCII-compatible characters will be coming through, double-and-triple-reinforce your app for this.

Love the code comment. Heh.
Can you translate the code above so all of us non-PHP programmers can enjoy? :)
Your comment is right, you should use `extract($_POST)` instead :p
This article - - might further clarify the issue.
James Skemp

If you are a competent programmer, you will be a competent programmer in PHP. If you are an incompetent programmer, you will be incompetent in any language. As you are strong in Java and C++, you will be strong in PHP - a language can't force you to code badly.

Even old versions of BASIC that only supported GOTO with line numbers for control flow didn't actually force anybody to produce spaghetti code; I know, because I used them in the 1970s, and my spaghetti code was due to me not knowing what I was doing back then ;-)


You should certainly know it, not least because there's a wealth of code out there which uses it and this can be a major advantage when assembling the code for a project (who writes everything from scratch nowadays?). And if you already code C++ and Java reasonably well you're pretty much innoculated to the badness of PHP already.

I pretty often make my language choice based on what utilities are available in what language for reuse in a particular project. Any reasonably competent coder should be able to get to a 'comfortable' stage with most languages pretty quickly. Expertese takes longer and much practice of course, but for many projects 'comfortable' is just fine.


if you want to go into web development learn it, not because it is the best or better then language x, but because you cant get around php if you do web development. the day will come where a client wants you to add some new feature to his existing web application, and chances are good that this application is written in php.

learn php, but as soon as you think you understood php and the general concepts of web development learn a second language (but dont stop learning php!), so you can choose yourself if php is the devil or not. :)

oh and dont forget to check out jQuery!

+2  A: 

IMO a not very known but terminal weakness of PHP is this :

  • to build modern, dynamic websites, you need powerful frameworks
  • to build a powerful framework, you need good generic programming facilities : a good object model, reflection, functional programming, closures, first class classes, etc, and also basic things like named function arguments, variable number of arguments, etc, all of this in an easy to use and friendly package, a good example is Python.

However PHP lacks severely in all these fields :

  • the object model is atrocious, classes are not objects, static methods don't work
  • reflection is awkward and not easy to use
  • no functional programming whatsoever
  • function argument passing is very C-like and inflexible

I can put up with all the low level crap like 'a' == 0 but this is really annoying.

+1  A: 

You should try PHP to feel yourself if it's bad or not. A lot of people complain about PHP because it doesn't stay in your way when you want to do a lot of bad practices - it doesn't mean you can't code "correctly" with it.

And since you said web development, don't just look for the language itself, look for solutions people created using PHP. I work with a lot of CMSs and they are mainly written in PHP. Do you plan to work in these kind of solutions? This is a factor to consider.


You have a strong background in C++ and Java, so picking up new languages should not be a problem for you. I would say go ahead and learn PHP. It is widely used, and is typically the language of web content management systems.

Python is another good one worth learning. Very dynamic compared to C++, and useful in a ton of situations such as web and admin work. It is also used by several very nice web stacks such as Django, TurboGears, Pylons, and others. Actually, my favourite language to code in, and I have used many starting with several assemblers, C, C++, Java, etc. etc.

I think with your background you will pick up either or both languages quickly.

Best of Luck.

Peter Bailey
+17  A: 

PHP can be a fine choice. I have developed code in C, Java, Perl, a bit of Python and Ruby, and many other languages. PHP is easy to learn, it's widely available, and jobs programming in PHP are easier to find.

If PHP is harmful, it's because it's too easy for people with no training in software engineering to learn. They are then able to deploy code with poor structure, poor performance, and security issues. And they are able to do so rapidly and in great numbers. Is that the fault of the language? I don't think so.

If you want to avoid being one of these people, then don't just study a programming language. Like any field, there are a lot of complementary skills that you need to have competence in:

If you have good understanding of fundamentals like these, the choice of one programming language over another is of less importance.

Bill Karwin
I'd like to see this answer at the top!
I agree @vmarquez.. this is the best answer
Derek Organ

I really recomend Zend Framework for PHP (IDE: Eclipse PDT) and Mootools for Javascrip


Go a head with php but make sure you use a Framework ...


I find PHP a really easy to use and helpful language, i would strongly suggest having atleast a basic understanding in this limitless language. Learn PHP


Pick the language that's hottest in your area. Hit Dice, search for PHP, Ruby, C#, VB.Net, Python, Java, etc and compare #'s. Sure, PHP isn't perfect, but it's very popular and in most markets, easy to land a job. Sure, PHP gets a bad rap, but who cares if Ruby or Python are "better" languages if you can't land a job writing in them?

Cory House