What is the difference between dynamic and static pages in PHP?
Dynamic pages in PHP are generated on-the-fly, meaning the content is generated each time a user requests the page. This allows for dynamic content to be displayed based on user input or database queries. On the other hand, static pages in PHP are pre-generated and do not change unless manually updated. Static pages are faster to load as they do not require server-side processing, but dynamic pages offer more flexibility and interactivity.
// Dynamic Page Example
<?php
echo "Hello, ".$_GET['name']."!";
?>
// Static Page Example
<!DOCTYPE html>
<html>
<head>
<title>Static Page</title>
</head>
<body>
<h1>Welcome to our website!</h1>
</body>
</html>