PHP is a Hypertext Pre-processor.. Its can be used for create web page..any PHP code in requested file can be executed by PHP run time..its run on only web server.
To contradict what has been said so far, the difference is that JavaScript can be written on the server side too and can get very complicated. JavaScript is often used as the client scripting language on the same page with PHP which does the server side stuff. ASP or ASP.net is an alternative to PHP.
For anyone who is interested in making websites or web site applications, you may have heard of these two terms but you cannot differentiate between the two. Basically, the first one, JavaScript
, is a client side programming language. This means that you can design and test this on your own computers server. This makes it easier if you cannot have access to the internet at the given time. It can be quite easy to learn as well but there is a limit to what you can do with JavaScript.
On the other hand you have the more powerful PHP and if you can learn this, you could produce some powerful and user interactive websites. However the problem with php is that it is a server side programming language, meaning that you have to test it on a web server. So PHP allows you to design powerful websites and Javascript is the easiest to learn out of the two.