Should I learn php or javascript first

To Javascript or not to Javascript... That is the question!
To Javascript or not to Javascript... That is the question!

What should I learn first?

Well, you have gone and done it now. You have asked the biggest, most asked question amongst new self taught web developers worldwide. Should you learn Javascript or PHP first? The answer is not that difficult and what matters most is what you are trying to achieve. Before we go any further, you must understand that Javascript and PHP are two totally different languages and are used for two totally different things!

Most of the time, when I receive a question from a would-be web developer, it consists of, "What are the two languages used for and which should I learn first." Again, what are you trying to do? It really doesn't matter which you learn first. They both have a learning curve, especially for someone who has never seen a programming language (or scripting language), and they both are used on the web equally. If you want a full arsenal of developing tools at your disposal, learn both. Simple as that.

I realize that this answer will probably not satisfy you because you are reading this because you want an answer of which to learn first. So I am going to say learn Javascript first. Why is this the answer I chose? Read below for a more informative reason.

Sams Teach Yourself JavaScript in 24 Hours (4th Edition)
Sams Teach Yourself JavaScript in 24 Hours (4th Edition)

One of the best "Teach Yourself" Javascript books available and highly recommended for people wishing to break into Javascript.

 

Javascript before PHP if you really want to know...

So I said learn Javascript first. I said this for two reasons. The reasons are:

  1. To familiarize yourself with a language and the anatomy of programming
  2. It's easier than PHP!

You need to understand how programming languages work in order to use them and Javascript is easier to learn because the syntax is easier and you don't have to work with a database like PHP. Javascript is simply browser based. It doesn't need to be compiled like C#, C++, Visual Basic, etc etc... What you type into your .js file is what will happen on the screen when the browser loads or when the end-user clicks on something that calls the Javascript to do something.

Now I know that some people will comment "Javascript isn't a programming language, it's a scripting language." Now while that is true, it really depends on who you talk to whether or not it could be considered programming. You still deal with syntax. You can still make web applications. You still go through the same headaches. So in my book, I will call it a web programming language.

Javascript will get you familiar with programming. It's a given. Like I stated above, there is a learning curve, especially if you are totally new to the programming game. I suggest that you get a good book on Javascript. I have used many good books, but the best I have used has been the one listed above. It really teaches you a lot and if you go through it a couple times, you can master the basics of Javascript in no time.

So in conclusion of this section, learn Javascript because it will familiarize you with programming and because it's easier and quicker to learn.

Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)
Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)

Learn all 3 in one easy to follow book. Recommended if you wish to get the benefit of learning all 3 languages in one book.

 
PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide
PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide

Visual book for those of you who learn better with visual aids.

 
PHP/MySQL Programming for the Absolute Beginner
PHP/MySQL Programming for the Absolute Beginner

The name says it all. I still recommend the first book. It is updated with newer material.

 

Learn PHP for powerful interactive websites

PHP is all about being able to build powerful websites that are able to manage content and streamline processes. PHP is the meat and potatoes of the web languages. The catch to this is that you need to also use a database such as Apache or MySQL. This means that in order to use PHP, you must also be aware of how to use a database. See why I suggested Javascript first?

If you are very dedicated to learning how to build nice dynamic websites, you will want to learn this language. But take my advice and still learn Javascript if you haven't already.

Now I'm not saying you can't learn PHP first. Many people choose to learn PHP first because you can do so much more with it. It is way more powerful than Javascript. The flipside to this is that the syntax can be much more difficult to learn and comprehend if you are new to this, and it takes twice as long to learn because you are learning two different things. The PHP and the database. It can be done however, and Javascript is not mandatory to learn first. It just takes time, dedication, trial, and error. But I still recommend Javascript first.

Some examples of what PHP can be used for are found below:

  • Joomla is based off of PHP
  • Wordpress
  • Drupal ( Just about any CMS out there )
  • Authentication ( logins etc etc )
  • Uploading and downloading things from a server database
  • Etc...

I think you get the picture. You can use PHP to do some pretty cool stuff on the web.

In closing...

If you are wondering what to use to program Javascript or PHP in, you can use any text editor such as notepad. Any windows machine will have a version of notepad on it.

So I hope this at least brought you a little closer to discovering which web language you want to learn first out of Javascript and PHP. Like I stated a billion times before, if you want to really be able to do some magical things on websites, learn both. They both serve their purposes well and one has advantages over the other. They both have their pro's and con's and one may be better for a certain task than the other.

If you liked this hub and found it informative, rate it as such. If you wish to discuss things further, post in the comments below. Thank you for reading and have a wonderful web experience!

More by this Author


Comments 13 comments

mskills profile image

mskills 5 years ago from North Carolina, USA

Oddly enough, I've warmed to PHP much quicker than Javascript. Maybe it is because of my lack of programming knowledge (Pascal[!] and a little C++), or perhaps it's the C-lite structure of Javascript that intimidates me.

Shame, really, since the whole AJAX thing is the ONE thing that keeps me from just throwing in the towel on learning Javascript.

I like the quiz, got an 80% on my first attempt (missed a Javascript-specific question, of course).


mrpudgy profile image

mrpudgy 5 years ago from Winnipeg, Manitoba Author

@mskills

It's awesome that you learned PHP first. It's a much more powerful language, not saying that JS doesn't have it's uses. But the whole fact that much of the internet is starting to rely heavily on databases, PHP is the web developers friend. Using JS and PHP hand in hand will find it's way to insanely awesome websites. =)


SsvRrwQ 5 years ago

Javascript is used as a server side language, typically using node.js or similar.


mrpudgy profile image

mrpudgy 5 years ago from Winnipeg, Manitoba Author

@SsvRwQ

Yes, it can use the server and send and receive information. Javascript is considered to be a browser based language however. Languages that use a database however, are PHP.

In the quiz, I stated that Javascript can send information to a server. Good to see comments. I like discussions.


Kitty 5 years ago

I've already startd learning JS ( before i read this hub )

I think I have more use for it rite now.

100% on the quiz :) ( first try )


Alexander Mark profile image

Alexander Mark 4 years ago from beautiful, rainy, green Portland, Oregon

Enjoyed the hub. I am thinking at this point that in terms of programming (not specifically web design) I would like to learn the language that teaches from the ground up to the most complicated.

I attempted javascript several times on w3schools (excellent teaching site by the way) and it completely eluded me. But when I started a class about Programming Logic and Design, it made total sense. Unfortunately I dropped that in favor of a class I thought I needed more, and I am now looking for a way to teach myself programming via the internet instead of college classes.

Any suggestions which language to start with? I'm a complete newb so I can only throw out the idea of C# - is that a good heavy language that will give me a firm base to understand other languages from?

I still have the book from that class and it is a wonderful resource, as it teaches how to map out decisions and loops and so on. Basic stuff I know, but it suits my learning style - step by step. Javascript makes logic leaps I can't grasp.


kschimmel profile image

kschimmel 4 years ago from North Carolina, USA

As a FORTRAN programmer who took 20 years off to raise a house full of kids, I am getting back in the groove. In library school I learned some PHP and MySQL in a database course. Since I was a good structured programmer, I'm planning to learn Java and Javascript. My engineering professor hubby says they are always needing someone to do Java programming at his school.


mrpudgy profile image

mrpudgy 4 years ago from Winnipeg, Manitoba Author

Just keep in mind that Java and Javascript have almost nothing in common. Javascript having the word Java throws some people off thinking they are similar in nature. Java is a whole other beast all together, so just keep that in mind, if you were thinking they were similar.

Good luck all the same!


kschimmel profile image

kschimmel 4 years ago from North Carolina, USA

Thanks, I knew the distinction. I figured a little Javascript to jazz up my webpages, and an in-depth study of Java to make myself more marketable.


mrpudgy profile image

mrpudgy 4 years ago from Winnipeg, Manitoba Author

Sounds like a good plan. All the best!


greyhat 2 years ago

you have a type in your article. you refereed to apache as a database when in reality it's web-server.


teresko 18 months ago

Really enjoyed this hub. Thank you so much.


mrpudgy profile image

mrpudgy 17 months ago from Winnipeg, Manitoba Author

Glad you enjoyed it.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working