What's the difference between javascript and php?

erwin1978

Golden Member
Jun 22, 2001
1,639
3
81
Can't you pretty much do anything with one or the other? I'd hate to learn so many languages when I can just master one that can do it all.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
PHP is scripting language used mostly on the server side to spit out dynamic content. Javascript is client side scripting language, which among other things allows manipulation of DOM elements within the page.
 

Rip the Jacker

Diamond Member
Dec 29, 2004
5,415
1
76
Languages such as PHP/ASP/Python/Perl reside on the web server itself, and spit out all the dynamic content via HTML which is read & displayed by the browser. Modern websites usually have a SCRIPT element that links to an external javascript file which controls the behavior of the website. Javascript should be treated like icing on a cake, never rely on it (well an exception would be if you wanted to make a 100% js application such as Gmail/Google Maps) but on a regular website you should never rely upon JS being there, since it can easily be disabled (some (govt?) companies do this).
 

hans007

Lifer
Feb 1, 2000
20,212
18
81
javascript runs on the client. there is some overlap between them as far as what you can use to do a certain thing, but the main thing is that java script is processed on the client.