tags:

views:

821

answers:

10

As the title says in your opinion which should I learn first PHP or Javascript. I am going to learn both but which order do you feel I should learn them in?

+6  A: 

I would say PHP. It should give you the feeling to write something "whole". If you hit a wall (i.e. need for AJAX), improve your php pages with JavaScript (but I would recommend JQuery, which is a JavaScript Framework).

Henrik P. Hessel
+3  A: 

Depends on what you want to do. If you want to make fancy effects and tweaks on your webpages, learn JavaScript. If you want to use a database or any other kind of server-side stuff, learn PHP.

Rusky
Or learn Django instead of php, if you have a choice, because - without offense - php is considered evil.
Tamás Szelei
The question was between PHP and JavaScript. You could easily replace PHP in that post with Python, Ruby or any other server-side scripting language.
Rusky
php **is** evil
spender
Sure. But a lot of people don't have a choice.
Rusky
Languages with significant whitespace don't get to throw rocks at other languages.
Iain Collins
+6  A: 

Javascript, being a client-side language is really a nicety (although with AJAX some would say a necessity). On the other hand, PHP is a server-side language which is a necessity if you want to build a dynamic site that speaks to a database. I would learn PHP first and then sprinkle in some Javascript later on.

Beavis
Thanks for the great answer has answered my question clearly.
Oliver Bayes-Shelton
+1  A: 

Javascript is a language that can run almost anywhere because it is supported on almost every browser, so you will most likely be able to use it in every situtation, no matter what you are programming in. (As long as it is web based)

PHP on the other hand starts the basis of knowledge about server-side programming if you have never dealt with it before. It lets you deal a lot more with cookies and databases than javascript does, and allows you to build an actual 'system', where data is persistent.

In all honesty I would learn PHP first because it is going to power your javascript if you need access to databases, and it will help you learn things like AJAX and JSON.

Plus, with libraries like jQuery, Javascript gets easier to learn.

Chacha102
+1  A: 

Without knowing more about your particular situation, I'll suggest that the documentation for PHP may be more helpful than the documentation you'll find for Javascript.

lance
+2  A: 

PHP because you will learn more about the server-side part of developing applications including database and sessions.

Then move to JS, when you need to do some client side stuff.

PHP is more marketable also.

Robert Greiner
+3  A: 

I'd like to add to other people's answers that it also depends on your background. If you understand how the web works, you could jump to Javascript first. If you don't, go for PHP, it will help you understand the web better, then Javascript will make much more sense.

Sinan Taifour
I think I will start with PHP :)
Oliver Bayes-Shelton
Good luck ! :)
Sinan Taifour
A: 

You could realistically go either way but I'd probably say PHP is a better place to start. PHP is more "strict" than JavaScript so you learn formalism a little better and can then relax with JavaScript.

Nick Gotch
I think that's the first time I've seen "PHP", "strict", and "formalism" all in the same sentence.
Greg Hewgill
Relative to JavaScript anyway :-p
Nick Gotch
I agree with the idea of learning PHP first, but I think, even when using best practice OO principles with PHP, that JavaScript is a lot stricter, e.g. with scope and types. JavaScript allows for some much more advanced OO paradigms than the J2EE-style syntax of PHP, which is one of the reasons I agree that PHP is better choice for a first language.
Iain Collins
+2  A: 

The fact that you're considering both is telling me you want to build rich internet apps. Start with PHP first and learn how a web application is built from the ground up. Get a feel for MySQL databases. After you think you know enough PHP make it rich with Javascript.

centr0
A: 

Depends on wheter you want to go on and learn ASP.NET. If you do, learn JavaScript. Server-side languages offer a lot more functionality (database connections, server-side page effects, etc.)

contactmatt