$file = file('clinic.dat');
foreach ($file as $line)
{
if(!strripos($line, "<|>")) continue;
$elem = explode('<|>', $line);
setlocale(LC_ALL, "ru_RU.urf-8");
$content = file_get_contents("./clinic/".$elem[0].".php");
preg_match("|question = <<< EOT(.*?)EOT;|is", $content, $matches2);
echo $question = $matches2[1];
//var_dump($question);
preg_match("|response = <<< EOT(.*?)EOT;|is", $content, $matches3);
echo $response = $matches3[1];
//var_dump($response);
//echo $elem[0].'<br>';
}
$file = file('clinic.dat');
foreach ($file as $line)
{
if(!strripos($line, "<|>")) continue;
$elem = explode('<|>', $line);
setlocale(LC_ALL, "ru_RU.urf-8");
$content = file_get_contents("./clinic/".$elem[0].".php");
preg_match("|question = <<< EOT(.*?)EOT;|is", $content, $matches2);
$question = $matches2[1];
var_dump($question);
preg_match("|response = <<< EOT(.*?)EOT;|is", $content, $matches3);
$response = $matches3[1];
var_dump($response);
//echo $elem[0].'<br>';
}
$file = file('clinic.dat');
foreach ($file as $line)
{
if(!strripos($line, "<|>")) continue;
$elem = explode('<|>', $line);
setlocale(LC_ALL, "ru_RU.urf-8");
$content = file_get_contents("./clinic/".$elem[0].".php");
preg_match("|question = <<< EOT(.*?)EOT;|is", $content, $matches2);
$question = $matches2[1];
var_dump($question);
preg_match("|response = <<< EOT(.*?)EOT;|is", $content, $matches3);
$response = $matches3[1];
var_dump($response);
//echo $elem[0].'<br>';
}
$file = file('clin.dat');
foreach ($file as $line) {
$elem = explode('<|>', $line);
echo $elem[0].' - '.$elem[1]. ' - '.$elem[2]. ' - '.$elem[3] .'<br>';
}
$articles = glob("./clinic/*.php");
foreach($articles as $article)
{
$content = file_get_contents($article);
preg_match("|\/clinic\/(.*).php|Ui", $article, $matches);
$file_id = $matches[1];
preg_match("|question = <<< EOT(.*?)EOT;|is", $content, $matches1);
$question = $matches1[1];
preg_match("|response = <<< EOT(.*?)EOT;|is", $content, $matches2);
$response = $matches2[1];
echo $file_id.'-'.$question.'-'.$response;
}
$search = $_POST['search'];
$lines = file('data/menu.dat');
foreach ($lines as $line) {
if (strpos($line, $search) !== false) {
$elem = explode('<|>', $line);
echo $elem[3].' - <a href="'.$elem[1].'">'.$elem[2].'</a><br>';
}
}