How do I calculate the visitors for the last 24 hours?
<p>I have the following code:</p>

<pre><code>$ips = file_get_contents($_SERVER['DOCUMENT_ROOT']."/visitors.txt");
$arr = explode(",",$ips);

$today =  strtotime(date('Y-m-d H:i:s'));

for ($n = 0, $max = count($arr); $n &lt;= $max; $n++) {
$visArr = explode("#",$arr[$n]);
$visDate = strtotime($visArr[1]); //$visArr[1] = 2011-12-27 14:10:45
  if($visDate &lt; $today){
     unset ($arr[$n]);  //remove array item if its date not within 24 hours 
  }
}
</code></pre>

<p>The data is stored like this:</p>

<pre><code>xxx.xxx.xxx.xxx#2011-12-27 11:56:24,

xxx.xxx.xxx.xxx#2011-12-28 11:56:24,
</code></pre>

<p>I want to get the visitors from the last 24 hours.</p>

<p>I don't want to use MySQL db, I just want to use the txt file but I'm stuck.</p>

<p>Thanks in advance.</p>
