PHP - display from txt file with explode function
hi, i am trying to display all data from a txt file with a function of explode but does not work.....
[PHP] <?
#reads a text file outputs it to screen
$filename = "cdlist.txt ";
$filepointer = fopen($filename ,"r"); // open for read
$cdArray = file ($filename);
for ($mycount = 0; $mycount < count($cdArray) ; $mycount++ )
{
$string = getvalue ($cdArray,1);
$aline = $cdArray [$mycount];
print "$aline $string \n";
}
fclose ($filepointer);
function getvalue ($text, $commaToLookFor )
{
$intoarray = explode(",",$te xt);
return $intoarray[ $commaToLookFor];
}
if (!($filepointer = fopen($filename ,"r"))) { exit; }
?>
[/PHP]
hi, i am trying to display all data from a txt file with a function of explode but does not work.....
[PHP] <?
#reads a text file outputs it to screen
$filename = "cdlist.txt ";
$filepointer = fopen($filename ,"r"); // open for read
$cdArray = file ($filename);
for ($mycount = 0; $mycount < count($cdArray) ; $mycount++ )
{
$string = getvalue ($cdArray,1);
$aline = $cdArray [$mycount];
print "$aline $string \n";
}
fclose ($filepointer);
function getvalue ($text, $commaToLookFor )
{
$intoarray = explode(",",$te xt);
return $intoarray[ $commaToLookFor];
}
if (!($filepointer = fopen($filename ,"r"))) { exit; }
?>
[/PHP]
Comment