PHP is not a replacement of HTML and CSS. PHP is a programming language. HTML and CSS is used for layout and design of websites. PHP, HTML and CSS can all work together peacefully.
Lets say for example you need to add a new button to your navigation. Currently without PHP you would need to update every page with the new button for your navigation. Using PHP you can create an HTML document with your navigation code only and use PHP to display it. This way you only need to update your navigation code and it will be changed across your entire website.
For example. You have a website that uses the following code for your navigation and you need to add a new link to a new page. You would have to update that code on every page of your site.
<div id=nav">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About Us</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="sitemap.php">Sitemap</a></li>
</ul>
</div>
- <div id=nav">
- <ul>
- <li><a href="index.php">Home</a></li>
- <li><a href="about.php">About Us</a></li>
- <li><a href="contact.php">Contact Us</a></li>
- <li><a href="sitemap.php">Sitemap</a></li>
- </ul>
- </div>
Now if you were using PHP you could take that code and put in a file call nav.html and use this piece of PHP code to display it.
<?php include("nav.html"); ?>
That one little piece of code would go on every page in your website where you want your navigation to appear. Now when you want to make a change to your navigation all you need to do is update nav.html
I hope this makes sense. There are more uses for PHP but that one stands out.
Dang! All that time I've being wondering how to make easily editable pages and forgeting about php include statement. Thanks for reminding.