Question: For the same content below.

```
<html>
<body>
<?php  $name="jhon"; ?>
    <table>
        <tr>
            <td>name</td>
            <td><?php echo $name;?></td>
        </tr>
    </table>
</body>
</html>

```

1.To save it as test.php,the output in firefox is as below.

```
name    jhon

```

2.To save it as test.html,the output in firefox is as below.

```
name    

```

Why same content with different file type result in different output?

Answer: 
Because you have your webserver configured to pass `*.php` files through the PHP interpreter which executes the PHP contained within the PHP files.

HTML files aren't configured that way on your webserver (though [you can configure it to do so](https://stackoverflow.com/questions/6295141/server-not-parsing-html-as-php)). As it is, the server believes it is just a plain HTML document and is returning it verbatim, and the browser is interpreting your PHP open/close tags as *HTML tags* that it just doesn't recognize and doesn't know what to do with (try to view the source and see if your PHP code is showing up *in the source*).
Your webserver (Apache etc) can identify and evaluate only .php files as per default configuration `AddType application/x-httpd-php .php` 

In order to execute any other scripts (say .html files) as PHP scripts you have to add AddType statement at your httpd.conf file like below (you have restart your webserver):

```
AddType application/x-httpd-php .html

```