First off, I don't think it wise to attempt to run both PHP3 AND PHP4 under PWS, unless you specifically configure it to use different file extensions for each version (e.g., .PHP3 files fed thru PHP3 engine, .PHP files fed thru PHP4 engine, etc.). This involves modifying that .REG file that comes with the distribution so that you configure it properly that way.
Second, what versions exactly are you trying to install? Currently the latest release is v4.0.3pl1. This version contains a great many additional files from previous releases, fixes various security issues and bugs, and is generally considered something to use. So if you don't already have this version, go get it. The one issue with this version is that in the Win32 .ZIP file, the .REG file talked about in README.TXT appears to be missing. It's a very basic .REG file and can be created by running NotePad and creating a file called PWS-php4.reg (honestly anything that ends with .REG is fine) and typing in the following:
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
".php"="C:\Program Files\PHP\php4isapi.dll"
where the 2nd line contains the extension of files you wish to have processed by the PHP engine (from your examples above I'm assuming you want to use .PHP) and the path to the PHP4ISAPI.DLL file included in the PHP4 distribution. In the example above, this is the C:\Program Files\PHP directory (note the use of TWO (2) backslashes for each backslash in the path...don't forget to do this!).
Then double-click this file to make sure the proper entry is imported in the Registry. Finally, following the instructions in the README.TXT file,
"- In the PWS Manager, right click on a given directory you want to add PHP
support to, and select Properties. Check the 'Execute' checkbox, and
confirm.
At this point, PWS should have built-in PHP support."
Were all these steps followed? If so, the next question is how did you load the page into your browser? The most common mistake people tend to make is double-clicking on the HTML file on their HD, thereby loading the file with a path like "file:///C|/InetPub/wwwroot/test.php". This does NOT go through the webserver. You must use a URL like "http://localhost/test.php" in order to make sure that you are loading the page via the webserver. Only then will your PHP file be handed off to the PHP engine for execution, with the generated output sent to your browser for display.
Does this make any sense?
P.S. Final note: The "echo" command is not a function and does not require the use of parentheses. So in your examples above, you can remove them. (e.g., just write
<? echo "this is the simplest, an SGML processing instruction\n"; ?>