|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-02-17 10:24 UTC] andre@php.net
[2001-04-10 10:00 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 15:00:01 2025 UTC |
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); }