PHP 4.0 Bug #9315 Updated: Weird array behavior
| From: | sniper@php.net | Date: | Tue, 10 Apr 2001 14:00:54 +0000 |
| Subject: | PHP 4.0 Bug #9315 Updated: Weird array behavior | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51312@lists.php.net to get a copy of this message | ||
ID: 9315
Updated by: sniper
Reported By: jeroen@vanoijen.nl
Old-Status: Feedback
Status: Closed
Bug Type: Arrays related
Assigned To:
Comments:
No feedback. If this happens also with soon to be released
PHP 4.0.5, reopen this bug report with a short example
script that can be used to reproduce this.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-02-17 10:24:12] andre@php.net
Please provide a reduced code fragment (<15 lines) producing
this behaviour.
Put no database queries etc. in it and rely on no external
files to ensure that we can reproduce it easily unless the
problem is not directly related to some db (or similar)
function.
---------------------------------------------------------------------------
[2001-02-17 07:21:14] jeroen@vanoijen.nl
Php only finds the last row of the second file to be excisting in the array; even if all the rows
are the same.
// Open file with 2 columns and parse into array
if ($fd = @fopen("int-osocat.txt", "r")) {
while (!feof($fd)) {
$line = fgets($fd, 4096);
$intercat = strtok($line, "t");
$osocat = strtok("t");
$key = $intercat;
$catvars[$key]["active"] = 1;
$catvars[$key]["osocat"] = $osocat;
}
fclose ($fd);
}
// open second file, and check contents against array
if ($fd = @fopen("art-intcat.txt", "r")) {
while (!feof($fd)) {
$line = fgets($fd, 4096);
$artikelnr = strtok($line, "t");
$intcat = strtok("t");
$key2 = $intcat;
if ($catvars[$key2]["active"]== 1) {
echo $artikelnr . "t" . $catvars[$key2]["osocat"] .
"<br>";
}
}
fclose ($fd);
}
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9315&edit=2