PHP is a programming language, or to be more exact a script language, which has to be interpreted using a web server. This makes it possible to dynamically create HTML. So basically all PHP does is to dynamically create HTML using defined statements. The web server delivers this HTML. The following figure illustrates this explanation.

JavaScript is also a programming language. Unlike PHP it is not interpreted on a web server but in a browser on the client, on the user's PC. Querying a server is not necessary for executing JavaScript.
This is important to know since many inexperienced programmers tend to mix PHP and JavaScript or use them incorrectly, especially when both programming languages are combined.
References
Further information on the programming language PHP can be found on the following sites: