echo是以错误的方式打印PHP-Control-Characters [重复]

This question already has an answer here:

(Edit: Sure you can find the answer on the other question (SOMEWHERE), but it's not exactly duplicate. My situation is different.)

I'm totally beginner level in PHP. This code in my "test.html" is for me absolutely straight-forward:

<html>
    <body bgcolor="ffff00">
    <?php
        echo '<hr>hello world<hr>';
    ?>  
    </body>
</html>

I get this page:

enter image description here

This isn't the first time I had this issue. Last time I solved it and now I don't know how. Why is it printing me the closing apostrophe and semicolon and the closing php-tag-end? What am I doing wrong?

</div>

You should save the file as .php not .html if you have php code.