Develop a PHP program (with HTML/CSS) to keep track of the number of visitors visiting the web page and to display this count of visitors, with relevant headings.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Visitor Counter</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
.counter {
font-size: 24px;
color: #333;
}
.heading {
font-size: 28px;
color: #007BFF;
}
</style>
</head>
<body>
<h1 class="heading">
Welcome to
<b style="color:red;, font-size:35px;">V</b>
<b style="color:black;">tudeveloper !</b>
</h1>
<?php
// File to store visitor count
$file = "visitor_count.txt";
// Check if file exists, if not create and initialize with 0
if (!file_exists($file)) {
file_put_contents($file, 0);
}
// Read current visitor count
$visitorCount = (int)file_get_contents($file);
// Increment visitor count
$visitorCount++;
// Update the file
file_put_contents($file, $visitorCount);
echo "<p class='counter'>Total Visitors: $visitorCount</p>";
?>
</body>
</html>