stupid array question

From: Date: Mon, 11 Apr 2011 13:05:20 +0000
Subject: stupid array question
Groups: php.general 
Request: Send a blank email to php-general+get-312333@lists.php.net to get a copy of this message
I have the following code which should increment the value of the array $iplist if there is a value there.  When I walk the array at the end, all the values = 1.  What am i doing wrong? --Curtis while (!feof($INPUTFILE))  {    $chunks = fgetcsv($INPUTFILE, " ", '"');    $firstpart = explode(" ", $chunks[0]);    $ipaddress = $firstpart[0];    $agent = $chunks[4]; //   print (stripos($agent, "compatible; MSIE 6.0; Windows NT 5.1; SV1")."\n");    if (stripos($agent, "compatible; MSIE 6.0; Windows NT 5.1; SV1") > 0)    {        $iplist[$ipaddress]++;        //print("$ipaddress\t$agent\n");    }    while (list($key, $value) = each($iplist))    {      print("$key\t$value\n");    }   }

« previous php.general (#312333) next »