Create variable name while inside a while loop
Posted: Thu Sep 29, 2011 11:00 am
Hello all.
My code is quite basic, a while loop that echos each line of a file. However i need to explode each line of data into a new array for every line.
My code as it was it
Which just echos each line to the screen.
What i need is as follows
My problem however is $line needs to be changed each time the while loop is run. What would be ideal is if i could add an incrementing number at the end of $line.
Any help would be great
Thanks
My code is quite basic, a while loop that echos each line of a file. However i need to explode each line of data into a new array for every line.
My code as it was it
Code: Select all
while (($buffer = fgets($FileHandle, 4096)) !== false) {
echo $buffer."<br>";
}
What i need is as follows
Code: Select all
while (($buffer = fgets($FileHandle, 4096)) !== false) {
$line = explode('|',$buffer);
}
Any help would be great
Thanks