getHashs(410)); // echo $rep->getCountRecords() . PHP_EOL; $dataInBase = [ [ 'spec_code' => '09.03.03', 'spec_name' => 'Прикладная информатика', 'edu_level' => 'Высшее образование - бакалавриат', 'edu_forms' => 'Очная', 'contingent' => 25, 'spec_id' => 3228, 'org_id' => 61297, 'is_actual' => 1, 'change_date' => '2024-10-25 10:10:10', ], [ 'spec_code' => '09.03.03', 'spec_name' => 'Прикладная информатика', 'edu_level' => 'Высшее образование - бакалавриат', 'edu_forms' => 'Очная', 'contingent' => 21, 'spec_id' => 3228, 'org_id' => 61297, 'is_actual' => 1, 'change_date' => '2024-10-25 10:10:10', ], ]; // Printer::println("DATABASE", Color::GREEN); Printer::print_r($dataInBase, Color::GREEN); $hashsMD5 = []; array_multisort($dataInBase); print_r($dataInBase); exit; foreach ($dataInBase as &$con) { } // echo 'HASHS' . PHP_EOL; // print_r($hashsMD5); $dataInSite = [ [ 'spec_code' => '09.03.03', 'spec_name' => 'Прикладная информатика', 'edu_level' => 'Высшее образование - бакалавриат', 'edu_forms' => 'Очная', 'contingent' => 26, 'spec_id' => 3228, 'org_id' => 61297, ], [ 'spec_code' => '09.03.04', 'spec_name' => 'Программная инженерия', 'edu_level' => 'Высшее образование - бакалавриат', 'edu_forms' => 'Очная', 'contingent' => 51, 'spec_id' => 3229, 'org_id' => 61297, ], [ 'spec_code' => '09.03.01', 'spec_name' => 'Информатика и вычислительная техника', 'edu_level' => 'Высшее образование - бакалавриат', 'edu_forms' => 'Очная', 'contingent' => 34, 'spec_id' => 3222, 'org_id' => 61297, ] ]; Printer::println("VUZ", Color::BLUE); Printer::print_r($dataInSite, Color::BLUE); uasort($dataInSite, fn ($a, $b) => $a['spec_code'] <=> $b['spec_code']); Printer::print_r($dataInSite, Color::RED); $countDB = count($dataInBase); $string = ''; for ($i = 0; $i < count($dataInSite); $i++) { $string .= implode(' ', $dataInSite[$i]); // if (!in_array($hash, array_column($hashsMD5, 'data_hash'))) { // if ($i < $countDB) { // $dataInBase[$i]['is_actual'] = 0; // } // if (!isset($hashsMD5[$i])) { // $hashsMD5[$i] = [ // 'org_id' => 61297, // 'sveden_table' => ContingentRepository::TABLE, // 'data_hash' => $hash, // ]; // } else { // $hashsMD5[$i]['data_hash'] = $hash; // // } // $dataInSite[$i]['is_actual'] = true; // $dataInSite[$i]['change_date'] = date('Y-m-d H:i:s'); // $dataInBase[] = $dataInSite[$i]; // } } $hash = md5($string); echo $hash . PHP_EOL; // Printer::println("DATABASE", Color::GREEN); // Printer::print_r($dataInBase, Color::GREEN); // Printer::println("HASHS"); // Printer::print_r($hashsMD5);