I have a very simple .php file with these contents:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
On Firefox it displays nothing (which is what should happen), but on Edge it just shows the code. I had the file full of code before, and I thought it might be an error in there so I deleted everything except for the bare HTML structure but it still shows the code.
I also read that it may be my text editor that adds a .txt extension so I added this php code before everything else in the file (I'm not sure this is the correct implementation but it didn't work anyway.)
<?php
header('Content-type: text/html');
?>
Your code is correct and you should check something else like your host and your URL and something else it's not a problem for your code and check it in another browser