So I have been working recently on a questionnaire script in php and I wrote a tool that would output a single txt file with a list of questions, each on it's own line. The file would look like so..
1 "Shopping for items is very important to me.." 2 3 4 5s 6 //notice the 5s
2 "I love it when it is a rainy day" 4 8s 12 16 32s
The first number is the Questions id number. Next within the double quotes is the question itself.
The next numbers that follow are id's of other questions that relate to that questions.
In the case of "5s", that is a special question and I want the file reader to detect if the number has an s after it.
$file = fopen("output.txt", "r");
$data = array();
while (!feof($file))
{
$data[] = fgets(trim($file));
}
fclose($file);
// Now I have an Array of strings line by line
// Whats next now??
My question is how can I code something that will read the file in this order:
(1)..The Question's ID number..
("Shopping for items is very important to me..")...Then the actual question itself disregarding the double quotes
(2 3 4 5s 6)...Then the actual numbers while being aware that some may be 'special'.
Can Someone PLease Help Me!!! THANKS!!