FormClasses/search_result.php

36 lines
776 B
PHP
Raw Normal View History

2024-05-27 11:40:02 +03:00
<?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);