PHP is nothing more than code interlaced within HTML. If you've ever worked with HTML, the code is merely just inserted into an ordinary text document. The extension, at this point, is neglible as its just text. However, on a server, if you wish for the code to be parsed it would have to have the extension .php, or whatever the extension is set to for PHP.
Basically, take the code...
Code:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "<p>Hello World</p>"; ?>
</body>
</html>
then, open your preferred raw-text editor, such as Notepad (windows) or Kedit (linux), paste the information into the edit-pane, file->save as, then simply save as "name.php" or whatever you'd like.
You'll probably have to select "All files" in the drop down menu so as to prevent either application from tacking on an extra extension.
HTH