Possible Duplicate:
I don't know C. And why should I learn it?

My goal is to be able to create online apps and dynamic, database driven websites. For instance, if in the future I get the idea for the next Digg or Facebook, I want to be able to code it myself.

To arrive there I think I have basically two paths:

Path 1

Start at a basic level, learning C, then C++ for OOP, then algorithms and data structures, with the goal of getting a solid grasp of computer programming. Only then move to PHP/MySQL/HTTP and start working on practical programming projects.

Path 2

Start directly with PHP/MySQL/HTTP and getting my hands dirty with practical projects right away.

What would you guys recommend?

  • I will suggest you should learn C language and learn basic oops concept practically. It is the base of programming. Latter on you just need to learn PHP syntax and some language specific concept. You need to clear your web programming funda. That's all.
    – Raxit
    Commented Dec 28, 2010 at 13:12
  • 4
    Possible duplicate - programmers.stackexchange.com/questions/14744/…
    – ChrisF
    Commented Dec 28, 2010 at 13:17
  • @Daniel - If you register your Stack Overflow account and associate it with your Programmers' account you'll regain ownership of the question and be able to post comments etc.
    – ChrisF
    Commented Mar 15, 2011 at 22:21
  • @PatrickHofman why? It points to the duplicate. To get the new style header I'd have to reopen and then reclose. Seems a lot of effort for zero benefit.
    – ChrisF
    Commented Nov 21, 2016 at 11:28

21 Answers 21


Here's the $100,000 question for you: is developing web sites the only thing you want to do? PHP is a very domain specific language, but arguably has a fairly low barrier of entry. I wouldn't call it object oriented, because that isn't it's focus. PHP exists for one reason: web sites.

If you ever have the possible idea to go in other directions in your carreer, I highly recommend learning on a more traditional language. It doesn't have to be C/C++, it can also be something like Ruby, Python, Java, C#, etc. Each of these are pretty good object oriented programming languages. That said, object oriented languages aren't the only way to do programming--even though it appears to be the most prevalent (at least it has better marketing).

PHP is also just one of many ways to do web programming. You have a host of options with Ruby, Python, Java, and C# (as well as Smalltalk if you are so inclined).

  • 6
    +1: learning Ruby, Python, or Java will give ample opportunities in the web development arena. Pick up PHP after you know a real language, so that its "quirks" don't infect your other coding.
    – asthasr
    Commented Dec 28, 2010 at 14:04
  • 1
    Not Ruby!!! Commented Dec 28, 2010 at 16:44
  • 3
    @George, why not? Commented Dec 28, 2010 at 16:58
  • 6
    I don't know who you've been listening to, but I've had nothing but good experiences with it. I might venture to guess that the neigh-sayers aren't as proficient with the idioms and practices of the language. Once you do, you'll long for them in other languages. Commented Dec 28, 2010 at 17:23
  • 3
    I want to add that sever side technology isn't everything when it comes to web development. I would tell you to learn (I meaning really learn these not just "Oh, I know how to make a link") really learn HTML, CSS and Javascript. Many people focus on the server side tech, which is important, but neglect the foundation of a web page. Commented Dec 28, 2010 at 18:56

Huh, this got migrated as I was composing my answer on StackOverflow. Oh well.

First of all, you do not need to learn C before learning C++, and in fact I wouldn't recommend going that route; a well-written C program doesn't look or behave much like a well-written C++ program. There's a popular superstition that you need to learn C first in order to be a "real" programmer; this isn't true (besides, Real Programmers use Fortran). C's just another language with its own set of advantages and disadvantages. One of the bigger disadvantages is that it is a horrible teaching language.

As for Web programming, neither C nor C++ are all that popular, and can safely be skipped. I've done a little programming in PHP, and while it's good for small, quick-n-dirty work, my impression is that it's not appropriate for anything on the scale of Digg or Facebook (which are projects far beyond the capabilities of any single programmer). My experience with it is very limited, but I've heard very good things about Python.

  • I disagree that C is "just another language." Most of our modern software infrastructure is built on C, from Operating Systems to device drivers, compilers and virtual machines, etc. C is basically the computing lingua franca. Having a good working knowledge of C is not only beneficial to understanding the low-level details of memory management, it also helps you speak the language of your OS. This knowledge can be invaluable when something goes wrong at a higher level, and can also help you make better implementation decisions as a software developer. Commented Dec 28, 2010 at 18:58
  • 1
    @Charles: if you really need to learn low-level details, learn assembler. The fact that a lot of modern infrastructure is built in C is an accident of history more than anything else. It really is just another language in a long line of systems programming languages. Just because it forces you to roll your own containers before you can get to work solving the actual problem doesn't mean it's teaching you anything useful.
    – John Bode
    Commented Dec 28, 2010 at 19:23
  • 1
    A lot of things we take for granted today are accidents of history - that doesn't change the fact that C's current place in existing software infrastructures, accidental or not, is certainly something special. Commented Dec 29, 2010 at 14:33

Answer: No. Don't learn C/C++ yet. In fact, never learn C++ unless your education or job requires you to. It's not worth it. C, however, is very useful to know, but see it as "advanced" and learn it once you need to.

So definitely get your hands dirty. But don't limit yourself to just PHP. Nothing wrong with PHP, but...well, yeah, actually there's plenty wrong with PHP, but it's good enough and there are a lot of jobs in it. But instead of C, also learn Python (which also has loads of jobs) and a functional language (to get perspective). It's also unclear if you already know PHP or not. If you don't, I suggest you start with learning to program using Python, which is a great beginners language.

Then learn C when you need to, for example if you need to write a C extension to Python for performance reasons, etc.

  • -1 There is nothing wrong with learning C++ before starting with PHP. I did... and it worked fine for me. Commented Dec 28, 2010 at 16:46
  • 1
    I didn't say it was wrong. I recommended him to do something else that IMO is better. That doesn't mean one is "Wrong" and the other "Right". Commented Dec 28, 2010 at 17:19
  • 2
    I completely agree. There is no need to start diving into managing your own memory until you have to - there are definite merits to learning to use other languages than PHP but C/C++ are not the ones I would recommend until you're really ready for them and you need features that nothing else will offer you. Or you want to. Either works.
    – glenatron
    Commented Dec 28, 2010 at 20:07
  • 2
    Also: C is small enough to be easy to learn. C++ takes years to become a master, which might be off topic for what the OP really wanted to do (web programming)
    – RyanWilcox
    Commented Dec 28, 2010 at 20:13

I would pick option 2.

I do agree that if you have C++ or C background it helps. but if you don't - just skip it and lean to properly use the tools that you need.

This does not mean however that you should not learn stuff like OOP, Algorithms & Data Structures. It just means that you can do all that using PHP.

  • 1
    Definitely. I'd recommend learning about databases (normalization and tuning), but for an awful lot of web projects, PHP is perfectly fine. Start with the basics, add some AJAX goodness, and you should be good to go. Of course, if you're going to do this for money you should spend some time learning "proper" development, as @epeleg suggests, but I think you can defer that until you figure out what it is you want to do.
    – TMN
    Commented Dec 28, 2010 at 15:55

Start getting your hands dirty with PHP. When you notice that you need more than that, that's the right moment to start learning e.g. C. Getting too much knowledge at once, without practical application, will only confuse and demotivate you.


First path is the long one, but it will give you a solid background in programming. You'll understand the concept, which is the most important if you ask me. Then the programming language becomes just a tool, you stop thinking about a language, and start thinking about the problem domain. Go for C/C++, understand the pointers, and references, recursion, etc.

Bottomline. Learn how to program, this practice is language independent.


Digg and facebook are both extremely high traffic sites and you need to know more than just php to make anything as scalable.

On the other hand unless you get put on the front page of Digg, you won't need to scale for a while.

Ultimately it's your choice and nobody can make it for you, but from personal experience, learning about and implementing data structures is lots of fun.


I don't see the point of learning C or C++ in order to do web programming. They're great languages to learn, sure, for a foundation in software development. If you really want to learn OOP, pick a language that is object-oriented in nature, such as C#. (Disclaimer: I am a C# / ASP.NET web programmer). With C# (or similar languages) you can learn object-oriented concepts at the same time as learning web programming. That way you can create something practical fairly quickly.


If you want to do web programming then skip the C and C++.

I would suggest you start with xhtml, css, and javascript, since these are at the core of what you want to do. When you no longer have to look up anything about these 3 subjects then you will have a rock solid foundation in web programming. One more thing, take a deep dive into object oriented javascript and don't just play around with the DOM.

Good luck, stay focussed, and have fun.


You could start at a basic level with PHP (PHP5 is OOP) directly.

Anyway you should consider doing algorithmic and data structures, this is the basic knowledge. Know how to transform your way of thinking into code, data, etc... and then apply it.

Iy you start directly with coding, you may be better in the first time because you'll have practical knowledge, but this doesn't mean you'll be able to write code efficiently.

  • Iy -> If? are you a dvorak user? Commented Dec 28, 2010 at 14:01
  • @dan_waterworth : no, just a horrible typer :D I'm French, and the Dvorak-fr keyboard isn't supported by most OS, except Linux. Which means that Windows only supports the Dvorak in English version, and even if I'm writing often in English, that would be useless or even counterproductive to use the original english-designed Dvorak keyboard for me. So I keep writing on my AZERTY (and not QWERTY) French keyboard :) Commented Dec 28, 2010 at 14:32
  • [= , I just thought you might be because the 'y' and the 'f' are in the same place of different hands on dvorak, (I make that mistake fairly often). Commented Dec 28, 2010 at 14:39
  • @dan_waterworth : and that could have been true with the Dvorak-Fr keyboard too, because F and Y are also near :) commons.wikimedia.org/wiki/File:Clavier-dvorak-fr.png Commented Dec 28, 2010 at 14:44

Do it for fun and knowledge, it will actually make you a better programmer. Knowing C/C++ will give you an excellent perspective of what other languages lack in "power" and how they make for it with simplicity and/or domain-specific features.

Personally, C/C++ has given me some insights on how js and PHP work underneath without having to ponder much about it (e.g. the delete operator and copy-on-write/pass-by-reference respectively).


Digg and facebook are both extremely high traffic sites and you need to know more than just php to make anything as scalable.
You don't. At least for digg. It's very simple data model. Facebook is a different story, but 90% of the time you'll be scaling database than webserver. With opcode caches you can get webserver machine to connect to several saturated DB machines, and on the webserver side you won't even notice any load.

I'd try C++ first (before any high level language like PHP/Python). Or any language that allows you to play with algorithms (Pascal)... it's always big difference when you know how the things actually work instead of just doing eg. sort($x)

  • 1
    I'd try Assembler first before any high level language like C/C++.
    – Residuum
    Commented Aug 20, 2011 at 12:37

I strongly recommend that you spend some time getting to know your way around C. At the least, get enough under your belt where you work through exercises that show you just how tricky memory management can be.

A great many PHP programmers do not know how pampered they really are when the following code 'just works'

$foo = array();

Even $foo = "string"; is something to appreciate.

I'm not suggesting that you chase a language that you are hardly likely to use, but I would recommend getting to know it to the point where you can appreciate other languages more.

  • I'm smiling because I know what playing with char*s can really be like. Commented Dec 28, 2010 at 16:48

I don't think it is neccesery to know C. While it is a simple language it is very difficalt to use. C++ is a vast language (maybe 10 times the size of C).

If you are getting started, Then start with the non programming languages that you suggested (html). Then look at scheme try this ebook http://mitpress.mit.edu/sicp/full-text/book/book.html After that try eiffel, its a very fast, easy to learn OO language.

  • "(maybe 10 times the size of C)" - What standard are we using to arrive at that number? Commented Dec 28, 2010 at 16:47

The benefit of learning any strongly typed language like C,C++,Java helps you understand the basics of programing. Secondly before learning any database applications try to learn about the RDBMS and basic SQL.50% of your job is done here.After that learning anything like MySql,Oracle etc will be much easier.

If you want to be a web programmer then i will prefer learning C and (C++ or Java) first.Then go for PHP .It will be very easy to grasp.


I love PHP, but it is not the best language to learn programming, as it is very permissive and sometimes encourages dirty programming habits.

Getting a solid foundation in clean C or C++, and OOP first and then switching to PHP is definitely an option worth considering. You will have little trouble learning PHP afterwards.

  • 2
    @Pekka I'm surprised at you! You know this question is off topic and duplicated many times. Why answer?
    – C. Ross
    Commented Dec 28, 2010 at 13:10
  • @C.Ross true. Making the answer CW. Programming.SE is not very present in my mind yet :) On the other hand, answers get migrated to the target site along with the question, so it's not really a problem.
    – Pekka
    Commented Dec 28, 2010 at 13:17
  • There is no solid foundation in C/C++. There are solid foundations in C, in C++, and in both (although that's overkill for the purpose). If you want OOP, use C++. Commented Dec 28, 2010 at 15:04

The trick is to learn each paradigm from a language that does it well.

Learn a statically typed OOP language like Python, C#, Java etc.. Learn C for the low-level systems. And if you have time, learn Haskell, Scheme, Lisp etc. for functional/declarative programming.

My first language was C++. It took me years to unlearn the quirks and bizarre hacks.


My re-introduction to PHP, which was required for us to just pick up in a few days for a final project in a Database class at UW-Madison consisted of, "if you know C++, then you should know PHP, just remember to use dollar signs"

If you don't do OOP and you actually like to program, you'll learn 'em simultaneously. The only hangup with PHP is when to use -> and when to use => and for that I'd really suggest actually reading a book to learn PHP, not just picking up what you need off the internet.

I think that's probably the only way to learn C++ as well. Don't fret about C though, I mean if you're in high school, then go learn C - otherwise forget about it.

One fun thing you may be able to do if you master them simultaneously is write extensions for yourself.

The thing people despise PHP for is that it is often coded as if it was a bunch of throwaway batch files - and that's what you need to avoid if you're going to make it as a web programmer. People despise C++ code that looks like C code for the same reason.

Go the distance with your code (in PHP use classes instead of infernally nested arrays; in C++ use classes instead of infernally nested struct's) and it will go the distance for you


There's only so much you can do with the whole PHP stack. If you want to make a career out of programming, web and otherwise, you should not base it off of PHP. For all you know, it'll be gone in a few years.

I recommend learning C first, skip C++ and learn Java or C# (and OOness, design patterns) while learning PHP. You'll find that it comes down to your knowledge of the fundamentals and technologies and not the specific languages.

PS Web programming kicks awesome butt! Good luck!

  • 1
    Skip C++? What is with everyone and discouraging use of C++? Millions of applications are written in C++! Many that you use on a daily basis! Commented Dec 28, 2010 at 16:50
  • @George Edison: C++ is too big of a language. It's much better for a beginner to start with something more manageable and then move on to C++.
    – user7146
    Commented Dec 28, 2010 at 23:07
  • @david: I started with it. (Well, I did learn QuickBasic first, but that was such a pathetic language that it doesn't even count - I never figured out how to do anything with it.) Commented Dec 29, 2010 at 1:00
  • @George Edison: Good for you.
    – user7146
    Commented Dec 29, 2010 at 1:36
  • Oh I meant no discouragement towards C++, it just so happens that most technologies on the web are not based on C++. I know all too well that C++ is as powerful as most languages I mentioned, if not more. Like I said, it's not about the languages, but the technologies and concepts.
    – kowsheek
    Commented Dec 29, 2010 at 3:04

Go and learn the basics: C and then C++ for OOP. It's important to understand those languages before learning high level languages. Although learning PHP as a first programming language can be possible but not recommended.

  • 2
    I've also seen it go other way round: People who understand how things "really" work at lower level look like they're trying to fit a square peg into round hole when learning high level languages. When you know (or think you know) what's going on under the hood, it's hard to resist doing all kinds of silly optimizations. For example, I've seen people setting object references to null in Java to "facilitate garbage collection" instead of just letting them fall out of scope, caching test expressions in for loops (when the compiler would actually do that for you) and such "too smart" stuff. Commented Dec 28, 2010 at 13:46
  • @Joonas, perhaps - but are you suggesting it's actually better to just be ignorant? Commented Dec 28, 2010 at 14:03
  • 1
    @Charles Salvia: I think it depends on what one is aiming for. If you want to do just web programming (the question's title is Should I Learn C/C++ Even If I Just Want To Do Web Programming?), then yes, I suggest that it's better to not learn C/C++. The point is that you're not getting paid for what you know. Nobody cares about that. You're getting paid for producing good enough, working code. And to produce good enough, working PHP / MySQL / HTTP stuff, knowing C/C++ is about the least important thing you need. Time is always limited, so focus on e.g. CSS, Javascript instead. Commented Dec 28, 2010 at 14:28
  • @Charles: "A little knowledge is a dangerous thing." Understanding everything is good. Understanding just enough to think that you know better is not necessarily good. Commented Dec 28, 2010 at 15:06
  • 1
    C++ for OOP is terrible, sorry. The very term 'OOP' was invented by Smalltalk crowd; Smalltalk or Python or Ruby are good for learning about OOP. C++, like Fortran or even C, is a necessary evil when you need high performance and know the underlying mechanics well.
    – 9000
    Commented Dec 28, 2010 at 15:51

I would start learning python the most beautiful programming language I know. Then if necessary trying to learn dirty things like PHP.

  • How many programming languages do you know?
    – Giorgio
    Commented Nov 24, 2012 at 13:01
  • I know several programming languages well such as python, perl, java, javascript, c and at a lesser extend c++, lisp, php, cobol, delphi Commented Nov 25, 2012 at 20:08