PHP foreach在第一次迭代后停止


php foreach stops after first iteration

好吧,我很困惑。

我有一个多星数组,其中有660条记录。当我运行我的foreach时,每次通过我应该得到一条记录,但我得到的只是第一条记录。我提高了我的错误报告,我没有得到任何回报,我没有在foreach中分配任何内存(只是输出表内容)。

代码如下:

$totCount = count($funnel);
echo "We found $totCount log entries<br><br>'n";  //  66x records!
echo "<table border='1'>'n";
echo "<tr><th>Visitor</th><th>Date</th><th>Time/Page ---></th></tr>'n";
$nCount = 0;  // number of records
$nRec = 0;
$ip   = "";   // current records ip address
$date = "";   // current records date
$time = "";   // current records time
$file = "";   // file that was viewed
foreach($funnel as $page);
{
  // process each record
  $nRec++;
  // if the ip's are different, this is a new visitor
  if( strcmp($page['ip'], $ip) != 0 )
  {
    if($nCount > 0) // only end a row if its not the first one
      echo "</tr>'n"; // close out this row
    // update the variables
    $ip = $page['ip'];      // save the new visitors ip
    $date = $page['date'];  // save the new visitors date
    $time = $page['time'];  // save the new visitors time
    $file = $page['path'];  // save the new visitors file viewed
    echo "<tr>'n"; // start a new row
    echo "<td>$ip</td><td>$date</td>'n";
    echo "<td>$time<br>$file</td>";  
    $nCount++;        
  }
  else
  {
    // not a new visit
    $time = $page['time'];  // what time was this page viewed?
    $file = $page['path'];  // where did they go next?
    echo "<td>$time<br>$file</td>";  
  }
}
echo "</table>";
echo "<br>Processing Complete. $nCount visitors of $totCount/$nRec";

上面的行说我有1个访问者,访问次数为66x, nRec为1,显示foreach执行了1次。

任何帮助将不胜感激!

foreach?

foreach($funnel as $page);
应:

foreach($funnel as $page)

删除foreach语句后面的';' -它基本上消除了它。