What is the difference between PHP and JavaScript?

PHP, the expansion of Hypertext Preprocessor is the programming language at server-side. JavaScript, commonly called as JS is a scripting language at client-side. The differences between PHP and JavaScript are:

                     PHP

                         Javascript

PHP runs on server and the major functionality of PHP is to produce the HTML code which will be read by browser. 

JavaScript can handle only local tasks that are specific.

In PHP, code will be available only after the server interprets it.

In JavaScript the code can be viewed even after the output is interpreted.

PHP is embedded only with HTML and PHP cannot be combined with XML.

JavaScript can be combined with HTML, XML and AJAX.

PHP is used to produce web pages on the go, read and deploy databases, import the files available on the server, and gain files of data from further domains. 

JavaScript can import files of information available by mentioning the URL of the file in the address bar of the browser.

PHP does not execute within a browser’s window.

JavaScript executes within a browser’s window.

PHP commonly uses MYSQL as a database.

MYSQL is not commonly used by JavaScript.