I have a script which at the moment works. But its only partially forfilling the purpose i made it.
I have a txt file called guests.txt
On each line there is 3 main values i want each seperated by tab dilimeters. eg,
NAME<tab char>EMAIL<tab char>BROWSER
I open my file up and perform the split function to seperate the string using the the tab pattern. And i successfully print them out from the arrays created using the split(); function.
<?php
if (!$file=fopen("guests.txt", "r")) {
echo ("Could Not open file");
} else {
$text = fread($file, 9999);
$pat = " ";
$arr = split($pat, $text);
echo ("
<b>Username</b> : $arr[0]<br>\n
<b>Email</b> : $arr[1]<br>\n
<b>Browser</b> : $arr[2]<br>\n");
}
?>
This is the code i have come up with which works.
But i would like to ask if in the
$pat = " ";
Is it possible in anyway just to use \t to represent a tab character insead of a literal tab whitespace. I've tried many combinations but they just don't work.
I also have one last query and that is, so far this code only works for the file if it has just 1 line of string text.
But what if i had many lines of
NAME<tab char>EMAIL<tab char>BROWSER
how would i go about writing code which prints out all of these?
Any ideas would be much appreciated.
Thanks
Elmer Lin