@MegaChriz: It worked!!! Not at first, but it worked. Thank you!!!
I'll explain...
The first problem was that I was opening the files from Finder, choosing "Open With..." or dragging to the browser icon, like you said.
Maybe in the beginning I knew the proper way to view the files, but after setting PHP down for a few months I forgot. That would explain my memory of having a working test server at one point.
Second problem: In anticipation of working on multiple PHP-driven websites, I created a subfolder "WebsiteName" within the htdocs folder.
I figured I could add more sites accordingly with time and it would be a good way to stay organized. I guess instead it broke my PHP functionality.
After reading your last suggestion I tried
http://localhost/WebsiteName/test.php to no avail. Got a "500 Internal Server Error". But then I tried moving the test.php file up one folder so that my filepath matched your example verbatim and now it works!
http://localhost/test.php works!
So with that problem solved, now I ask: why does putting the PHP files in a subfolder stop them from being parsed?
And what is the correct way to manage multiple sites, if not with subfolders?
Thank you!