Hello, I believe a php file must always be processed by a server before it shows in your browser what you want to see.
Apache is your (local) server and will process anything in the HTDOCS folder.
If you just open a php file on your computer without a server processing it for your browser you will just see the (php) code.
You did nothing wrong, just get a bit more acquainted with how php works.
PHP is called a
server side language for a reason
