PHP is a server-side language which lets you interact with other web-pages.
Basically it goes in a HTML file (but you have to use a .php extension) like so:
When the file goes on the web, it is completely invisible to the user. Even if you download the php file, you get the results of that php script. So that's why php is good for processing passwords/usernames or any time of stored data.
//PHP CODE GOES HERE
That's php in a nut-shell.
PHP Functions/Manual/Reference: http://www.php.net/