Which programming language should I learn?

I’ve been asked this question twice in the last 2 weeks by people wanting to write their first Web application. So I’m going to answer it here for anyone else interested:

If you want to write Web applications you need to learn the following languages: Javascript, PHP, HTML, CSS and SQL. It sounds like a lot, but it really is not. You can learn enough of each of these languages to write a basic Web application within a week. Trust me. It’s easy!

PHP is the guts of your Web application. It is the language that runs on your web server. It is also the only language where you have a choice about learning it or learning another language. You must learn HTML, CSS and Javascript and 99% of web programmers learn SQL to talk to a database. But there are many other languages to choose from that can do the same thing that PHP does.

However, if you are starting out writing web applications, PHP is the first server language you should learn and here is why:

  1. PHP is used by a huge number of websites, both big and small. Most of Facebook is written in PHP. Wikipedia powered by Mediawiki is written in PHP.
  2. WordPress, the worlds most popular open source blog platform is written in PHP. If you know PHP you can change it any way you like or even contribute to the community. WordPress is used by eBay, Yahoo, Digg, The Wall Street Journal, Techcrunch, TMZ, Mashable and of course the whole of WordPress.com is powered by WordPress written in PHP.
  3. Most of the worlds best content management systems are written in PHP.
  4. The PHP community is massive and supportive, unlike the Ruby on Rails community for example.
  5. 99% of web programmers can understand PHP, even though some don’t realize it. (like Perl Developers)
  6. PHP is a mature language which means the bugs have all been ironed out and it runs fast!
  7. If you Google a question you have about PHP, you have a much higher likelihood of finding an answer than any other server programming language.
  8. Don’t learn Perl because even though it’s a mature, fast and popular language, it’s harder to learn than PHP.
  9. Don’t learn Java because Java is better suited to launching spacecraft and running systems that control oil rigs or banking software than Web applications. It is strongly typed which means that you need to write more lines of code to get the same thing done. It’s also harder to learn because it’s a purer object oriented language . It also is owned by Oracle which means it’s a commercial language and that means Oracle will continually be trying to sell you stuff by making things seem harder than they are and claiming they have the answer to the problem they created in your mind.
  10. Don’t learn .NET because it’s also a commercial language and pretty much everything made by Microsoft either will cost you money or will break a lot.
  11. Don’t learn Ruby because the guys who run the community are total a-holes who will insult you for asking beginner questions. Ruby is also way less popular than PHP or Perl even though it’s used to power Twitter. It’s also the reason Twitter is down so often.
  12. Don’t learn Brainf*ck, Cobol, D, Erlang, Fortran, Go, Haskell, Lisp, OCaml, Python or Smalltalk because these are languages that people tell you they know to show off. Some of them have specific advantages like parallelism, being a pure object oriented language or being compact. But they are not for you if you are starting out. In fact, the combination of PHP and Javascript will give you 99.99999% of what all these languages offer.
You also need to learn two presentation languages: HTML and CSS. They are actually part of each other because HTML is not too useful without CSS and vice versa.

HTML tells the browser the structure and content of a page. e.g. Put a form after a paragraph and have one field for email and one for full name.

CSS tells the browser how to make that page look e.g. Which fonts to use, what size they should be, what colors, how wide or tall things on the page should be, how thick borders should be, how much padding to use and how thick to make margins.

Then you also need to learn a data storage language called SQL which lets you talke to a database to store things like visitor names, email addresses and so on. For example, using SQL you can tell a database to store an email address and full name by saying “INSERT INTO visitors (name, email) values (‘Mark Maunder’, ‘mark@example.com’);. There are other ways to store data and a popular terrorist movement calling itself NoSQL has formed in the last 4 years and they spend their time sowing fear and doubt about SQL and confusing beginners like you. The reality is that 99% of web applications use SQL and continue to use SQL. It works, it’s fast, it’s easy to learn and everyone understands it. It’s used by WordPress, Wikipedia, Facebook and everyone else who counts, whether they like it or not. Just learn SQL!! I also recommend you use MySQL to store your web application’s data (even though it’s owned by Oracle) because it’s the most popular open source database out there. PHP applications use MySQL more than any other database engine on the web.

To summarize, so far you need to learn:

  • Javascript (a programming language that runs on inside your visitor’s browser)
  • PHP (a programming language that runs on the server)
  • HTML (a presentation language that tells the browser the structure of a page)
  • CSS (a presentation language that tells the browser how to make a page look once it’ knows the structure)
  • SQL (a data access language that lets you store and retrieve data from a database)
Each of these languages runs or executes in a certain place or environment:
  • Javascript runs inside the browser of someone who has visited your website. What’s cool about this is that it uses your visitor’s CPU and memory instead of the resources on your server.
  • PHP runs on your own web server. Most websites use a kind of “container” or application server to run PHP called Apache Web Server with something called mod_php installed. Apache handles all the web server stuff like receiving the request for the document and making sure it’s formatted correctly. It then passes the request to mod_php which is executing your PHP code. This actually runs your web application written in PHP, your program sends the response back to Apache which sends it back to your visitor.
  • HTML is interpreted by a visitor’s browser and tells the browser how to structure the page as it loads.
  • CSS is also interpreted by a visitor’s browser and tells the browser how to make the HTML look.
  • SQL is a language that you use inside your PHP application to talk to a database like MySQL. You will actually write SQL in your PHP code but it will be sent to the database engine which is where it is interpreted and executed. The database then sends your PHP code whatever it asked for, if anything. (sometimes you’re just inserting data and not asking a question)
As you progress you will get familiar with the platforms you run each of these languages on. They include:
  • Linux is the operating system you will run on your server. Everything else on your server runs on top of Linux. Linux lets your web application talk to the server’s hardware.
  • Apache Web Server running mod_php. This is the application server you will use to run your PHP code. It will receive the web requests, forward them to your PHP code, and receive the response which is forwarded to your visitor.
  • MySQL database engine. You will talk to mysql using SQL which is written inside your PHP code.

One last note to help you in your language decision making. It’s important that you understand there are a few phenomenon that may confuse you in your language research:

The first is that some software developers have little life beyond writing software and have large egos. One of the few things they have to impress you with is their own intelligence. They will try to make programming sound harder than it actually is. It’s not hard. It’s easy.

Secondly, an arrogant programmer may regale you with a list of programming languages to choose from and tell you that he or she knows them all. They may make the choice sound complicated. It’s not. They’re just showing off. Choose PHP and the set of tools listed above and you’ll be fine.

Third, remember that there is always something new and shiny coming out that will get a lot of attention and is advertised to “change the way we…” or will “make everything you know about programming irrelevant”. Ignore the noise and stay focused on the basics. Until a new language, operating system, application or piece of hardware has been around for a while (usually at least 5 years), it’s going to be full of bugs, run slow, break often and it will be hard to get help by Googling because few people are using it and have had the problem you’re having.

Lastly, many companies like Google and Facebook spend a lot of time and energy trying to attract the best software engineers in the world. Google associated themselves with NASA purely for this reason, even though they’re in completely different businesses. To draw attention to themselves as thought leaders in software they talk a lot about languages like Erlang, Haskell and so on. The reality is that their bread and butter languages are pretty ordinary – languages like C++ and PHP. So don’t get confused when you see Facebook talking about using Erlang for real-time chat. They’re just showing off. Their bread and butter is PHP, HTML, CSS, SQL and Javascript, like most of the rest of the Web.

Who am I and how dare I express an opinion on this? I’ve been programming web applications since 2 years after the Web was invented. I’m the CEO and CTO of a company who’s web apps are seen by over 200 million unique people every month. I also own the company.  I’ve seen languages and platforms come and go including Netscape Commerce Server, Java Applets, Visual Basic, XML, NetWare, Windows NT, Microsoft IIS, thin clients, network computers, etc.

The Web is Simple. Programming is Easy. Now go have fun!!


76 thoughts on “Which programming language should I learn?

  1. Thank you …very much it gives us a clear idea how internet works out and it is a good presentation …it really helps to me to develop web application …..thank you very much

  2. your article is so awesome, your the best guy i have ever heard on planet earth. i was scared before but now am ready for web apps. Thanks. Good job

  3. Amazing article for real amateurs like me … Thanks a ton Mark !!! I’m completely new to programming..All that i know is C,C++ and SQL .. I wanted to get into web programming ..and there i found a super springboard in your article !! Thanks again man !! Keep writing :-)

  4. This post looks good. Your experience is supporting to what you claim. What is the future of Web? If web dies in the future due to the popularity of device specific apps what is the future of PHP?

  5. Hey I know this is off topic but I was wondering if
    you knew of any widgets I could add to my blog that automatically
    tweet my newest twitter updates. I’ve been
    looking for a plug-in like this for quite some time and was hoping maybe you
    would have some experience with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  6. You may likewise take a whey protein shake in the evening.
    Deficiency of protein affects the health of common
    people and especially athletes as their bodies
    utilize maximum amount of protein on daily basis to heal up the muscle injuries
    and breakdowns. Rigorous workout sessions can certainly drain the actual muscles of one’s which results in a requirement for more gas.

  7. Great Insight Mark. I am currently in the process of learning languages to create web apps. I had taught myself C++ before delving into html and css, now, I am trying to learn Javascript. I plan to learn PHP and MySql afterwards. Your thoughts have been an inspiration. From somebody who is teaching themselves by looking at forums and how to websites, I totally understand what you meant by some programmers putting other languages down. I hope you write more about programming. I would love to read more about your thoughts.

  8. Hi Mark, Thanks for such a nice article, it’s really helpful and gives a clear path to adopt to start learning PHP and its associated tools/technologies with convinced mind.

  9. Each and every language has its own importance but that doesn’t mean that they are not good and the PHP is the only language that is better. Being an open source it do have benefits and even easy to learn but still other languages can’t be ignored.

  10. Pretty section of content. I just stumbled upon
    your web site and in accession capital to assert that I acquire
    actually enjoyed account your blog posts. Anyway
    I’ll be subscribing to your feeds and even I achievement you access consistently fast.

  11. I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but definitely you are going to a famous blogger if you aren’t
    already ;) Cheers!

  12. To the author: thank you for this! This demystified quite a bit for me and I plan to follow the advice you suggested. Given that you posted this about two years ago, I assume you’d still give the same basic advice today?

  13. I have absolutely no argument with PHP being the first language you should learn as a web programmer. I really have to protest putting Python on the list of “showoff” languages, however (especially since it’s on the same list with Brainf***k). Learning Python won’t give you the same intimate knowledge of a program’s function that you would get from say, C, but it’s a terrific beginner’s language, and it really teaches you how to think intuitively about computerized problem-solving. To this day, I frequently use Python to test my ideas when working on a difficult problem in another language.

  14. What i do not understood is in truth how you’re

    now not actually a lot more neatly-

    preferred than you might be now. You are very intelligent. You

    realize therefore significantly in

    relation to this matter, produced me

    in my view consider it from so many various angles. Its like women and men are not

    fascinated except it’s one thing to do with Woman gaga! Your individual stuffs outstanding.

    At all times take care of it up!

  15. Dear Mark:

    Thanks for your post! One question about this post is:
    Do you still hold this point of view that one should best to learn PHP as web dev language right now?
    I still in Univ, having no idea about real Software world, I just read articles comparing between Python, Javascript(like node.js), RoR, PHP, it really confuse me a lot!



  16. I enjoyed your post. You don’t vacillate in your recommendations.

    With over 10 years of proprietary relational database programming experience I wanted to advance my online store beyond PayPal HTML snippets. I licensed a shopping Perl cart without knowing the language. It impressed me that the code was accessible, could output HTML, and maintained its own database without “talking to” another application.

    Would have preferred to learn PHP but the price was right and the code is what it is. As you say, Perl 5x is mature and robust. In little more than a year, I have totally transformed the shopping cart code — integrating JavaScript and CSS but have barely scratched the surface of Perl. The experts always seem to know a more efficient ways of accomplishing something. I am beginning to focus more on optimization than features.

    One on the biggest challenges is multi-browser/platform compatibility. MSIE9 default security settings interfere with cookies. I have yet to begin testing Windows 8.

    Having said all this, perhaps PHP is a better first-time language to learn. I read that is has many built-in web features that are more difficult to implement in Perl.

  17. Thank you for ending my quest.
    I have been asking the question on Google in different ways “What programming language are web apps written in?”
    You have now given me a start.

  18. Hello sir

    i am manoj yadav acually i am webdesigner my skills html css html5/css javascript jqury wordpress magento but now i want learn php so sir me what should i

  19. Thank you so much…to providing this important information….
    I know the HTML, CSS and javascript..
    but their is a confusion in my mind about the .net and php. now i will totally consecrate on SQL and PHP..

  20. thanks sir, I need to learn even just basic programming language and I don’t have any idea where to start or what to learn that I can really use.. this is a very huge help to me., thanks..

  21. please am a beginner to these languages,can i master them in 7 months.please can u tell me how to build php webpage on my computer.

  22. This all depend in which city you live, In a metropolitan area you better go with Java, C#, or C++. Your salary will be close to double of what you will make working as a PHP developer.

  23. Great to learn PHP, but::

    PHP jobs pay less than Java, Ryby, and C# jobs.

    There are more PHP programmers than any other languages looking for jobs.

    Many PHP projects are made wrong because most of the PHP programmers are starters or students.

  24. I am so relieved by this article. Thanks so much mark for this, i really appreciate. Guess i’m gonna fasten my seat belts and start digging into the languages.. Cheers (y)

  25. Thank you very much,i am totally new to web designing,i wasted two weeks deciding so as to what to learn….now i am clear,thousand thanks-from India.

    and one more thing i am pursuing computer science engineering(2nd year).I know c and c++,does this change anything(perhaps some advantage) :-)

  26. wow reading this beautiful article made me so hopeful of life and i feel so confident to learn. thank you for your beautiful article. this is what i call cyber therapy and we need for of these articles. thank you again

  27. Straight to the point! And the reasons you pointed out why someone shouldn’t learn Java, C# or Ruby are hilarious…

  28. Thanks so much for this post Mark. I know HTML and CSS well, but haven’t dug much into other languages.

    Do you have any recommendations for books/resources for learning PHP and Javascript?

    • That’s precisely what I wanted to ask!
      Mark – any recommendations on resources to learn PHP, Javascript?

      • Try the youtube channels ‘thenewboston’ and ‘phpacademy’. On thenewboston’s channel there are over 200 php video tutorials, mostly by the creator of phpacademy, whose own channel has many more. I find watching videos easier than reading books, although as with books you should test your skills from time to time.

  29. Brother Mark
    You have really put my mind to rest. l am into webdesigning and have been learning php for sometimes. Your article has given me the stability to focuse on advancing on php. Infact when you learn php and javascript, your web development nightmares are over. You are right, brother, many programmers try to show off with an array of langauages they claim to have knowledge of when they can not even develop an ordinary CMS. Good work. Keep it up. Thanks very much.

  30. Honestly, PHP is for sometimes developers who also work at bookstores. .NET is a professional platform (not a language) for computer scientists that make their living writing software. Don’t settle for a toy language / platform.

  31. Don’t dismiss Python so readily – it’s an extremely useful language to learn. It has a clear and understandable syntax, and it can be intergrated with other languages. It’s basically really easy to learn, making it a great beginners’ language. You might have a lot of experience, but don’t dismiss languages other than your favourites so easily.

  32. that is really helpfull and well organized and i see your point when we share knowledge its more more better than keeping it as a secreat “knowledge shines” ..thanks ^_^

  33. Thanks, this makes it easy for me because for a long time I was struggling to find out where to start, this is really helpful

  34. It’s funny I came across this post today, because over the past two weeks I’ve been waking up to the fact that I need to be focusing on precisely the languages you discuss here.

    For nearly two years I’ve had a love-hate relationship with Ruby on Rails and haven’t really learned it. It isn’t that RoR is difficult or that I am especially slow-witted. The reason is that I just can’t get myself “into” it. The whole RoR ecosystem feels too self-contained, I found RVM to be a major chore, and inexpensive hosting is scarce. What I see in heavy, continuous use is HTML, CSS, JavaScript, PHP and SQL. These are what I see on a daily basis as a site producer, and which I know I’ll be using more and more as I really learn to develop.

    That said, my experience with the RoR community has been nowhere near as negative as what you described, but perhaps I’ve been fortunate with the group I know in the NYC area.

    Thanks for your post, confirming very well my own conclusions and adding to them.

  35. [quote]
    Linux is the operating system you will run on your server. Everything else on your server runs on top of Linux. Linux lets your web application talk to the server’s hardware.
    Hopefully not. Pick something with high performance, high stability, and more secure: FreeBSD (or one of the other BSDs).
    The only excuse for picking Linux is Hardware support.

  36. Hey guys, sorry about the delay on approving these. I switched my gmail to important mail first and apparently comment alerts didn’t make the cut.

    Piers, my comments re .NET and MS were a little tongue in cheek but I do think languages created by an open source community tend to be mired in less commercial intent than languages like Java or .NET.

    Thanks for the correction Aby and Jeff. Doh!!

    Jeff, I’ll write something up re my views on source control real quick.

  37. I saw your post via @hnfirehose, great read! If I had seen this coming out of college I probably would have gone PHP instead of C#, lulz. BTW, quick typo note, I think you have the parenthetical parts of the following two bullets switched: “Javascript (a programming language that runs on the server)” and “PHP (a programming language that runs inside your visitor’s browser)”. I’d love to read your thoughts on where beginning programmers should steer toward as far as source control.

  38. Solid article for a beginner; minus all the hype around languages. Later down the road people will pick up other languages as they mature when their work demands something different, or their curiosity itself.


    To summarize, so far you need to learn:

    Javascript (a programming language that runs on the server)
    PHP (a programming language that runs inside your visitor’s browser)

    Mixed there :P

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.