Does anyone know of a way to get php to read a file and then out put it into an array like:
$var[1][2]
where 1 is the line number and 2 is the word? Thanks.
Reading from a file
Moderators: Moderator, Global Moderator
Reading from a file
[code]<?php
$lines = file("news_system.ffd");
foreach($lines as $key => $val)
{
$data[$key] = explode("||", $val);
}
for($q = 0; $q < sizeof($lines); $q++)
{
echo $data[$q][0];
echo $data[$q][1];
echo $data[$q][2];
}
?>[/code]
There\'s a snippet from my flat file db news script, but this is only putting the different data from the file into an array..... I guess you could try and modify this to get what you\'re looking for though
$lines = file("news_system.ffd");
foreach($lines as $key => $val)
{
$data[$key] = explode("||", $val);
}
for($q = 0; $q < sizeof($lines); $q++)
{
echo $data[$q][0];
echo $data[$q][1];
echo $data[$q][2];
}
?>[/code]
There\'s a snippet from my flat file db news script, but this is only putting the different data from the file into an array..... I guess you could try and modify this to get what you\'re looking for though
[align=center]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]
Reading from a file
To get it to explode on the space though so it gives each word... what's the character for space? it's not " "
Reading from a file
Where there\'s char 32 and char 106.... 32 is the more used though.. not sure what\'s so special about 106 though.
[align=center]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]
