Need help resetting a php counter
<p>I'm really new to php. I decided to make a counter based off a script I've seen. I've made changes to it. I'm trying to figure out how to reset the counter.</p>

<pre><code>$userCount = file_get_contents("count.txt");

$userCount = trim($userCount);

$userCount = $userCount + 1;

$countReset = $userCount - $userCount;

$file = fopen("count.txt","w+");

fwrite($file,$userCount);

fclose($file);

print "The number of visitors is: $userCount";

if ($userCount &lt; 20){
echo 'not yet';
}
else {
echo 'done!';
}

if ($userCount &gt; 40){
fwrite($file,$countReset);
fclose($file);
}
</code></pre>

<p>I tried subtracting the counter from itself to get it back to 0.</p>

<pre><code>$countReset = $userCount - $userCount;
</code></pre>

<p>However, it doesn't seem to work. the counter itself works, but I am unable to get it to reset back to 0.</p>

<p>This is just an impression like script I'm doing as a way to learn php. Also, sorry about the format, struggling with this post editor.</p>

<p>Any help with the script?</p>
