Re: Looping needs to re-open parm file

From: Date: Thu, 19 Dec 2002 11:16:08 +0000
Subject: Re: Looping needs to re-open parm file
Groups: php.general 
Request: Send a blank email to php-general+get-128842@lists.php.net to get a copy of this message
Hiya something like this <?
        if ($FileContent = file("d:\MyPhp\\test.ora") AND $IniContent = file("d:\MyPhp\initORA.ini")) {
                foreach($FileContent AS $line) {
                        if (in_array($line, $iniContent)) {
                                 echo "$Line<BR>\n";
                        }
                }
        }
?> At 12:00 19-12-02 +0100, Jacob van Zanen wrote:
Hi All, I'm reading a paramter file and a text file. Per line of the text file I want to check if there is a word in there from the parameter file. However I need to open and read the parameter file for each line in the text file. How can I change this? Followin is the code I have. <? if (!($FileContent = file("d:\MyPhp\\test.ora"))) { Print ("File could not be opened"); exit; } while (list ($LineNum, $Line) = each ($FileContent)) { // Open an ini file if (!($IniContent = file("d:\MyPhp\initORA.ini"))) { Print ("File could not be opened"); exit; } while (list($KeyNum, $IniParm) = each($IniContent)) { if (strstr($Line,rtrim($IniParm)))
     {
      print ("$Line<BR>\n");
     }
} } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#128842) next »