<?php
$data = [
[
'name' => 'Брянск'
],
[
'name' => 'Москва'
],
[
'name' => 'Бобруйск'
],
];
usort($data, function ($v1, $v2) {
return strcmp($v1['name'], $v2['name']);
});
$letter = null;
foreach ($data as $v) {
$currentLetter = mb_substr($v['name'], 0, 1, 'utf-8');
if ($currentLetter !== $letter) {
$letter = $currentLetter;
echo "--- $letter ---", PHP_EOL;
}
echo $v['name'], PHP_EOL;
}
echo 'blabla';
header("Location: /feed");
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.site\.ru
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]