Вот мой файл: http://www.mediafire.com/?17bggsa47u4ukmx
В основном это текстовый файл с другим расширением.
Это тест, для которого я создаю тестовый ридер в html / javascript / php.
Я хочу, чтобы он прочитал $$ 0, означающий первый вопрос, а затем получил следующую строку контента после него, что всегда будет вопросом.
Мой код:
В php:
$lines = file("hlm08.dat"); //file in to an array
// Make it search the whole file possible using a while loop by replacing the $$0
if (in_array("$$0", $lines)) {
echo "I found first Question Number";
/// Code to find the question right after it
}
Часть файла:
Hotel and Lodging Management
I
$$0
What do some hotel chains develop to establish formal relationships with employees?
A. Applications
B. Regulations
C. Policies
D. Contracts
/D
Contracts. Contracts are agreements between two or more people or organizations
stating that one party is to do something in return for something provided by
the other party. Employment contracts usually specify what an employee is
expected to do in exchange for being compensated by the hotel chain. These
contracts are often considered legal agreements that establish formal
relationships with employees. Hotel chains often develop regulations and
policies that employees are expected to follow, but these do not establish
formal relationships with the employees. Applications are forms that potential
employees fill out to apply for jobs.
$$1
An impact of antitrust legislation on business is that it prevents hospitality
businesses from
A. experiencing growth.
B. being competitive.
C. raising prices.
D. forming monopolies.
Я не уверен, как заставить сканировать весь файл и поместить все вопросы в массив. вопросы приходят сразу после каждого $$ 0 (номер вопроса).