36 lines
776 B
PHP
36 lines
776 B
PHP
|
<?php
|
||
|
namespace src;
|
||
|
|
||
|
use Information;
|
||
|
|
||
|
require_once "src/Information.php";
|
||
|
require_once "Search.php";
|
||
|
|
||
|
$fileName = "Information.txt";
|
||
|
|
||
|
$file = fopen($fileName, "r");
|
||
|
|
||
|
$arrKey = array('surname', 'name', 'patronymic', 'dateOfBirth', 'gender', 'countryCode', 'phoneNumber', 'email');
|
||
|
|
||
|
$parsingArray = array();
|
||
|
|
||
|
echo "<pre>";
|
||
|
print_r($_REQUEST);
|
||
|
|
||
|
$forSearch = '/\b(' . $_REQUEST['result_search'] . ')\b/ui';
|
||
|
|
||
|
while (!feof($file)) {
|
||
|
$str = fgets($file);
|
||
|
if(search($forSearch, $str)){
|
||
|
//if(search($str, $forSearch)){
|
||
|
$array = array_combine($arrKey, explode(";", $str));
|
||
|
/* echo "<pre>";
|
||
|
print_r($array);*/
|
||
|
$obj = new Information();
|
||
|
$obj->load($array);
|
||
|
$parsingArray[] = $obj;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
echo "<pre>";
|
||
|
print_r($parsingArray);
|