<?php
$fileName = 'fileName.txt';
$doubles = [
'withRegister' => [],
'withoutRegister' => [],
];
$fileHandle = fopen($fileName, "r");
if ($fileHandle) {
while (($line = fgets($fileHandle)) !== false) {
$lineWithoutRegister = mb_strtolower($line);
if (!isset($doubles['withRegister'][$line])) {
$doubles['withRegister'][$line] = 0;
}
if (!isset($doubles['withoutRegister'][$lineWithoutRegister])) {
$doubles['withoutRegister'][$lineWithoutRegister] = 0;
}
$doubles['withRegister'][$line]++;
$doubles['withoutRegister'][$lineWithoutRegister]++;
}
fclose($fileHandle);
} else {
throw new Exception('Error read file.');
}
echo "\nДубли с учетом регистра:\n";
foreach ($doubles['withRegister'] as $line => $count) {
if ($count > 1) {
echo "{$count} дублей:\n{$line}\n";
}
}
echo "\nДубли без учета регистра:\n";
foreach ($doubles['withoutRegister'] as $line => $count) {
if ($count > 1) {
echo "{$count} дублей:\n{$line}\n";
}
}
Вопрос 2: в базе DLE хранит "url" якобы в поле "alt_name", но не полностью )) на выходе url выглядит как поле "id-"+поле "alt_name"+".html"
т.е. в данном примере итоговый url выглядит 39-lekciya-tayshi-abelyar-1994g.html, а в поле alt_name хранится только lekciya-tayshi-abelyar-1994g
(\(\d+, '[^'<>]*?)<\/?[^<>]*>
$1
(\(\d+), '(.*?)[|]{3}.*?', (\d+\),?)
$1, 'upload/$2', $3
(\(\d+), '(.*?)(?:[|]{3}.*?)?', (\d+\),?)