Here's an example PHP code for a simple visit counter
Mark
<?php
// Open the text file in "read" mode
$file = fopen("counter.txt", "r");
// Read the existing count
$count = fgets($file);
// Close the file
fclose($file);
// Increment the count by 1
$count = $count + 1;
// Open the file again in "write" mode
$file = fopen("counter.txt", "w");
// Write the new count to the file
fwrite($file, $count);
// Close the file
fclose($file);
// Output the count
echo "This page has been visited $count times.";
?>
In this example, the visit count is stored in a text file called "counter.txt". The script reads the existing count from the file, increments it by 1, and then writes the new count back to the file. Finally, the script outputs the count to the webpage.
Note that this is a very basic example and there are many other ways to implement a visit counter in PHP, depending on your specific needs and requirements.