В файле keys.txt ключи русские. каждый с новой строки.
При применение скрипта выходит не понятно что(((
![c9743a40e96c4318924cf3518c8060b2.png](https://habrastorage.org/web/c97/43a/40e/c9743a40e96c4318924cf3518c8060b2.png)
Подскажите как исправить, пожалуйста!
<?php
error_reporting(0);
$data = file('keys.txt');
$seek = file('keys.ini');
$step = 10;
$i= 0;
$out = array();
//$out = mb_strtolower($out, 'UTF-8');
foreach ($data as $key => $val) {
$tmp = trim($val);
if (!empty($tmp)) { $out[$i] = str_replace(' ', '-', $tmp); $i++; }
}
if ($step > count($out)) {
foreach ($out as $key => $val) {
echo $val, '<br />';
} die();
}
if ($seek[0] >= count($out)) $seek[0] = 0;
for ($k=0; $k<$step; $k++) {
$test = $out[$seek[0]];
$test = str_replace('+', ' ', $test);
$test = str_replace('%20', ' ', $test);
$test = str_replace('-', ' ', $test);
echo '<li><a href="/',$out[$seek[0]],'.html" ', 'title="',$test,'">',$test,'</a>','</li>';
echo "\r\n";
$seek[0]++; if ($seek[0] == count($out)) $seek[0] = 0;
}
file_put_contents('keys.ini', $seek[0]);
?>