Should I learn PHP before Javascript?

PHP seems to be butting its head into more and more of what I’m doing.

I’ve mastered (or at least have become proficient in - you be the judge of that :slight_smile: ) CSS and HTML, but I still have yet to learn all of Javascript. Such things as JQuery and other things will follow, surely.

This discussion might be heavily biased by the fact that I’m posting in the PHP forum, but should I learn PHP before Javascript?

Also, what the heck is PHP, exactly?

Thanks for the input (well, if there is any :smiley: )
~TehYoyo

They are very Different. Javascript (JS) is client side scripting meaning that code is executed in the client browser. PHP is server side scripting meaning that the code is executed on the server.

Which one you learn first is up to you, learning one will make learning the other much easier.

I would recommend you finish off your learning of JavaScript and then you could go on to learning jQuery. Why? You’ll then be a front-end Web developer. You will want to know some PHP too, but you don’t need to master it unless you intend to become a back-end Web developer, in which case you really will need to also learn database development / management alongside MySQL.

Learning JavaScript will mean you can learn PHP much easier when it comes to it. But then, learning PHP will mean you can learn JavaScript much easier when it comes to it. Either is fine. I recommend JavaScript first, then PHP. But learning about such things as server-side includes will definitely help you out and is something you should look at now rather than later.

I have to learn MySQL as well? :cry:

~TehYoyo

Your ability to use PHP to it’s full advantage without knowing MySQL would be significantly less so than if you did know MySQL. There are things you should learn about PHP right now that will be of a tremendous help for you when building mainly static Websites, but if you’re serious about learning PHP, spending time, money, and efforts on learning it, then you’ll be learning MySQL too.

I have a few books on PHP that I go through when I need to learn how-to do something, but I’ve not properly taught myself PHP & MySQL as of yet. I’m focusing on my front-end development skills for now. Once I’ve mastered that, I will eventually move on to dedicating my time to mastering PHP & MySQL.

What books do you recommend? Are there any Sitepoint books?

~TehYoyo

Are you talking about PHP & MySQL books or JavaScript books?

PHP and MySQL books mainly.

~TehYoyo

I agree with @AndrewCooper, finish learning Javascript to round out front end development. You can also start learning SQL so you can try out mobile app development ala Phonegap. Mobile development usually utilizes Javascript, so it will help. SQL will also help you learn to structure your data as well for storage and retrieval.

You can get yourself familiarized with PHP when you start working with AJAX, if you haven’t already.

If you enjoy messing around with your own computer, and are not afraid of experimenting, changing settings and so on – then you might prefer to learn programming PHP – because it is a server-side language, and interacts with the server.

If you are happier messing around with the behaviours on websites, altering images, backgrounds how graphical elements react and so on – then you might prefer to learn JS – because you are in effect programming the DOM of the browser.

Learn either language, but thoroughly mind you … and you will pick up the principles of programming, many of which will apply to all other programming languages too – so the second or third language you then go on to learn will be more or less familiar to you because you should have grokked the principles.

It may well be that at various stages of your learning you will be tempted to give up, so it is important to have a solid target in mind – some goal you want to reach. This stuff is hard to do correctly.

Hi TehYoyo,

Generally the really good front end designers thoroughly know XHTML, CSS, and Javascript (then libraries like jQuery, YUI…). So if you did not have the requirement to use both PHP and MySql then I would recommend you focus on Javascript.

As far as PHP/MySQL goes you may want to try Kevin Yank’s ‘How to build a database driven website’. This coincidentally was the very first book I used (first edition) to learn PHP and a little MySQL. Then if your pocket book stands it maybe consider picking up ‘Simply SQL’ by Rudy Limeback of the Database forums - a thorough starter introducing you to SQL.

Steve

What about for Javascript? I’m trying to get my library to buy Simply Javascript, but I don’t know the progress on that…it seems like the only true-beginner Javascript book there is.

Would you recommend any non-Sitepoint books?

~TehYoyo

Jason Gilmore is the author I recommend for those just learning PHP and MySql. I learned both reading his first beginning book, then wrote my own task-management web-based app, and then got a job at newcars.com 5 months later doing php (i think they’re on python now)

In my sense,I will tell you should learn Javascript before PHP. In my sense , the serial should be HTML => CSS => Javascript => JQuery => PHP/MySQL

Hi TehYoyo,

I don’t know if you have already moved past this thread, but if not here are some good non-Sitepoint books.

Hope this helps

Steve

Yes - I’ve seen those books tossed around. I just find JavaScript super dull - I got through 120 pages, was way over my head, and stopped.

I’ll check that out.

~TehYoyo

Another superb beginner JS book is Dom Scripting, by Jeremy Keith. It’s a few years old now, but a new version came out recently—edited by someone else—but both are excellent.

Another good PHP starter is PHP Solutions, by David Powers. I’m working through that now.

I just have the PDF version of both books, because PDFs are cheaper (and easier to use, IMHO). I like to keep books as references, and I take a long time to chew over them, so a library option isn’t much interest to me.

I agree with this. It’s the same route I took, minus PHP/MySQL. It basically like going from easiest to hardest, depending on the person.

Basically PHP is a server side language which generates HTML code required to build a webpage. So knowledge of JavaScript is not related with PHP. But if you know JS you can generate HTML code with JS to build a dynamic webpage.