Do I need to echo html inside included php file

Posted by UmeRonaldo on Stack Overflow See other posts from Stack Overflow or by UmeRonaldo
Published on 2013-10-30T19:17:24Z Indexed on 2013/10/31 3:54 UTC
Read the original article Hit count: 121

Filed under:
|

I just learned how to include php .Here's the index or main php file

<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
    <?php include 'header.php'; ?>
</body>
</html>

now in header.php file which way is better to print html

Way 1 directly use html without php

<header>
<h1>Header</h1>
</header>

Way 2 Using php and echo

<?php
echo '
    <header>
    <h1>Header</h1>
    </header>
    '
?>

Another quick question. Will it work if I use .html for the base or index file ?? sorry for my bad english

© Stack Overflow or respective owner

Related posts about php

Related posts about html