Jump to content

[SOLVED] Array File opening?


Anim9or

Recommended Posts

Hi,

I was wondering if sanyone could help me with the fopen tool.  I'm tring to open a certain number of files, and pront out a specific line from them.  However, the function only seems to work when a single number is given.  If you use a variable, it will only access the first varaible number, even after the varaible is augmented.  Here is the code:

 

for ($read=0;$read<=$z;$read++) {
	$File2 = 'images/data/$read.txt';
	$file[$read] = @fopen($File2, "r");
	while($lines<3){	  
		 $line[$lines]=fgets($file[$read]);		  
		 $lines++;
	}
	echo "<br>$read";
	echo "<br>$File2";
	echo "<br>$line[1]";
	fclose($file[$read]);
}

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/127759-solved-array-file-opening/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.